Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - no records found from SQL DB=problems
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

no records found from SQL DB=problems

 Post Reply Post Reply Page  12>
Author
neosarcastic View Drop Down
Newbie
Newbie


Joined: 06 February 2004
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote neosarcastic Quote  Post ReplyReply Direct Link To This Post Topic: no records found from SQL DB=problems
    Posted: 16 February 2004 at 3:08pm

Here's a new one i am having trouble with...

I am using Dreamweaver with ASP connected to SQL 2000.
I have constructed a search and results page...which works great, except that when i miss-spell a search parameter, it shows an error 500 on every pc on the network.  There is a dreamweaver tutorial that has shown me how to display empty records on the results page should there be no match to my query.  This is fine except users don't get as far as the results page.  if they have miss-spelled criteria or they have searched for a record that does not exist I would like them to see "sorry no records found" like I said Dreamweaver shows us how to do this but the tutorial assumes that we see the results page. After submitting it just goes to a 500 - internal server error.

Is this something i can solve with code on the search/results page or is this an SQL thing?  (I don't believe it is an SQL thing as the current intranet connected to the database does not have these issues)

any ideas would be great.

 

Thanks

Back to Top
Semikolon View Drop Down
Senior Member
Senior Member


Joined: 09 September 2003
Location: Norway
Status: Offline
Points: 1718
Post Options Post Options   Thanks (0) Thanks(0)   Quote Semikolon Quote  Post ReplyReply Direct Link To This Post Posted: 16 February 2004 at 3:13pm
  1. Drop the dreamweaver code and write all yourself
  2. turn off friendly http error messages in IE
  3. post the error here
Back to Top
neosarcastic View Drop Down
Newbie
Newbie


Joined: 06 February 2004
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote neosarcastic Quote  Post ReplyReply Direct Link To This Post Posted: 16 February 2004 at 3:19pm
great, if I were an ASP writer but I am not, never claimed to be, and never want to be.  That is why I have DW.  "Show friendly HTTP error messages" is turned off, still does the same thing.  If there is a snippet of code somewhere that I can insert/learn than great.
Back to Top
Semikolon View Drop Down
Senior Member
Senior Member


Joined: 09 September 2003
Location: Norway
Status: Offline
Points: 1718
Post Options Post Options   Thanks (0) Thanks(0)   Quote Semikolon Quote  Post ReplyReply Direct Link To This Post Posted: 16 February 2004 at 3:24pm

generated code is really hard to edit, so it might not be easy to help you with this..

can you paste the error message you get? including the line and some of the lines before the error line

Back to Top
neosarcastic View Drop Down
Newbie
Newbie


Joined: 06 February 2004
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote neosarcastic Quote  Post ReplyReply Direct Link To This Post Posted: 17 February 2004 at 7:58am

Thanks for offering your help,
The error page shows code, i know there is a response.write trick but i cannot figure that out.  So this is the actual code that shows in the browser when i search for criteria that is not matching in the DB.

<%@ language="VBScript" %>
<%
  Option Explicit

  Const lngMaxFormBytes = 200

  Dim objASPError, blnErrorWritten, strServername, strServerIP, strRemoteIP
  Dim strMethod, lngPos, datNow, strQueryString, strURL

  If Response.Buffer Then
    Response.Clear
    Response.Status = "500 Internal Server Error"
    Response.ContentType = "text/html"
    Response.Expires = 0
  End If

  Set objASPError = Server.GetLastError
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

<html  dir=ltr>

<head>
<style>
a:link			{font:8 pt/11pt verdana; color:FF0000}
a:visited		{font:8pt/11pt verdana; color:#4e4e4e}
</style>

<META NAME="ROBOTS" CONTENT="NOINDEX">

<title>The page cannot be displayed</title>

<META HTTP-EQUIV="Content-Type" Content="text-html; charset=Windows-1252">
</head>

<script> 
function Homepage(){
<!--
// in real bits, urls get returned to our script like this:
// res://shdocvw.dll/http_404.htm#http://www.DocURL.com/bar.htm 

	//For testing use DocURL =  "res://shdocvw.dll/http_404.htm#https://www.microsoft.com/ba r.htm"
	DocURL=document.URL;
	
	//this  is where the http or https will be, as found by searching for :// but skipping the res://
	protocolIndex=DocURL.indexOf("://",4);
	
	//this finds the ending slash for the domain server 
	serverIndex=DocURL.indexOf("/",protocolIndex + 3);

	//for the href, we need a valid URL to the domain. We search for the # symbol to find the begining 
	//of the true URL, and add 1 to skip it - this is the BeginURL value. We use serverIndex as the end marker.
	//urlresult=DocURL.substring(protocolIndex - 4,serverIndex);
	BeginURL=DocURL.indexOf("#",1) +  1;
	urlresult=DocURL.substring(BeginURL,serverIndex);
		
 	//for display, we need to skip after http://, and go to the next slash
	displayresult=DocURL.substring(protocolIndex + 3 ,serverIndex);
	InsertElementAnchor(urlresult, displayresult);
}

function HtmlEncode(text)
{
    return text.replace(/&/g, '&amp').replace(/'/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
}

function TagAttrib(name, value)
{
    return ' '+name+'="'+HtmlEncode(value)+'"';
}

function PrintTag(tagName, needCloseTag, attrib, inner){
    document.write( '<' + tagName + attrib + '>' + HtmlEncode(inner) );
    if (needCloseTag) document.write( '</' + tagName +'>' );
}

function URI(href)
{
    IEVer = window.navigator.appVersion;
    IEVer = IEVer.substr( IEVer.indexOf('MSIE') + 5, 3 );

    return (IEVer.charAt(1)=='.' && IEVer >= '5.5') ?
        encodeURI(href) :
        escape(href).replace(/%3A/g, ':').replace(/%3B/g, ';');
}

function InsertElementAnchor(href, text)
{
    PrintTag('A', true, TagAttrib('HREF', URI(href)), text);
}

//-->
</script>

<body bgcolor="FFFFFF">

<table width="410" cellpadding="3" cellspacing="5">

  <tr>    
    <td align="left" valign="middle" width="360">
	<h1 style="COLOR:000000; FONT: 13pt/15pt verdana"><!--Problem-->The page cannot be displayed</h1>
    </td>
  </tr>
  
  <tr>
    <td width="400" colspan="2">
	<font style="COLOR:000000; FONT: 8pt/11pt verdana">There is a problem with the page you are trying to reach and it cannot be displayed.</font></td>
  </tr>
  
  <tr>
    <td width="400" colspan="2">
	<font style="COLOR:000000; FONT: 8pt/11pt verdana">

	<hr color="#C0C0C0" noshade>
	
    <p>Please try the following:</p>

	<ul>
      <li id="instructionsText1">Click the 
      <a href="javascript:location.reload()">
      Refresh</a> button, or try again later.<br>
      </li>
	  
      <li>Open the 
	  
	  <script>
	  <!--
	  if (!((window.navigator.userAgent.indexOf("MSIE") > 0) && (window.navigator.appVersion.charAt(0) == "2")))
	  {
	  	 Homepage();
	  }
	  //-->
	  </script>

	  home page, and then look for links to the information you want. </li>
    </ul>
	
    <h2 style="font:8pt/11pt verdana; color:000000">HTTP 500.100 - Internal Server
    Error - ASP error<br>
    Internet Information Services</h2>

	<hr color="#C0C0C0" noshade>
	
	<p>Technical Information (for support personnel)</p>

<ul>
<li>Error Type:<br>
<%
  Dim bakCodepage
  on error resume next
	  bakCodepage = Session.Codepage
	  Session.Codepage = 1252
  on error goto 0
  Response.Write Server.HTMLEncode(objASPError.Category)
  If objASPError.ASPCode > "" Then Response.Write Server.HTMLEncode(", " & objASPError.ASPCode)
  Response.Write Server.HTMLEncode(" (0x" & Hex(objASPError.Number) & ")" ) & "<br>"

  If objASPError.ASPDescription > "" Then 
		Response.Write Server.HTMLEncode(objASPError.ASPDescription) & "<br>"

  elseIf (objASPError.Description > "") Then 
		 Response.Write Server.HTMLEncode(objASPError.Description) & "<br>" 
  end if



  blnErrorWritten = False

  ' Only show the Source if it is available and the request is from the same machine as IIS
  If objASPError.Source > "" Then
    strServername = LCase(Request.ServerVariables("SERVER_NAME"))
    strServerIP = Request.ServerVariables("LOCAL_ADDR")
    strRemoteIP =  Request.ServerVariables("REMOTE_ADDR")
    If (strServername = "localhost" Or strServerIP = strRemoteIP) And objASPError.File <> "?" Then
      Response.Write Server.HTMLEncode(objASPError.File)
      If objASPError.Line > 0 Then Response.Write ", line " & objASPError.Line
      If objASPError.Column > 0 Then Response.Write ", column " & objASPError.Column
      Response.Write "<br>"
      Response.Write "<font style=""COLOR:000000; FONT: 8pt/11pt courier new""><b>"
      Response.Write Server.HTMLEncode(objASPError.Source) & "<br>"
      If objASPError.Column > 0 Then Response.Write String((objASPError.Column - 1), "-") & "^<br>"
      Response.Write "</b></font>"
      blnErrorWritten = True
    End If
  End If

  If Not blnErrorWritten And objASPError.File <> "?" Then
    Response.Write "<b>" & Server.HTMLEncode(  objASPError.File)
    If objASPError.Line > 0 Then Response.Write Server.HTMLEncode(", line " & objASPError.Line)
    If objASPError.Column > 0 Then Response.Write ", column " & objASPError.Column
    Response.Write "</b><br>"
  End If
%>
</li>
<p>
<li>Browser Type:<br>
<%=  Server.HTMLEncode(Request.ServerVariables("HTTP_USER_AGENT") )  %>
</li>
<p>
<li>Page:<br>
&l t;%
  strMethod = Request.ServerVariables("REQUEST_METHOD")

  Response.Write strMethod & " "

  If strMethod = "POST" Then
    Response.Write Request.TotalBytes & " bytes to "
  End If

  Response.Write Request.ServerVariables("SCRIPT_NAME")

  lngPos = InStr(Request.QueryString, "|")

  If lngPos > 1 Then
    Response.Write "?" & Server.HTMLEncode(Left(Request.QueryString, (lngPos - 1)))
  End If

  Response.Write "</li>"

  If strMethod = "POST" Then
    Response.Write "<p><li>POST Data:<br>"
    If Request.TotalBytes > lngMaxFormBytes Then
       Response.Write Server.HTMLEncode(Left(Request.Form, lngMaxFormBytes)) & " . . ."
    Else
      Response.Write Server.HTMLEncode(Request.Form)
    End If
    
   
Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post Posted: 17 February 2004 at 9:30am

Is that directly from your browser? There shouldnt be any ASP inside it... Are you sure you didnt paste the 500 error pages source code?

Back to Top
neosarcastic View Drop Down
Newbie
Newbie


Joined: 06 February 2004
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote neosarcastic Quote  Post ReplyReply Direct Link To This Post Posted: 17 February 2004 at 10:04am

That is what shows in my browser... i know it is weird.  Using IIS 5.0(which is successfully serving a current/old ASP intranet with no problems.)  This is all DW's doing I think, and I am disgusted with it's performance.  However I still have to solve this.  The error is an ASP 500 error, usually isn't this a permission error?

Thanks

Back to Top
Semikolon View Drop Down
Senior Member
Senior Member


Joined: 09 September 2003
Location: Norway
Status: Offline
Points: 1718
Post Options Post Options   Thanks (0) Thanks(0)   Quote Semikolon Quote  Post ReplyReply Direct Link To This Post Posted: 17 February 2004 at 12:07pm
isnt this the 500 error page source code?
Back to Top
 Post Reply Post Reply Page  12>

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.