Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Searchpage

Status
Not open for further replies.

TrueJoker

Technical User
Jun 14, 2006
115
GB
I'm new to ASP and ahve tried to setup a webpage that will search an MS Access database and display the results accordingly.

I have setup up a connection to the database and a recordset stating what information is to be shown and in what order etc.

I have setup a simple form with a search field but when submit is clicked i get a message:

The website cannot display the page
HTTP 500
Most likely causes:
The website is under maintenance.
The website has a programming error.

I ahve been assured that the server I am using has been updated so ASP can be used.

Just in case anyone is interested here is the code so far.

code of searchpage:

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/URL]
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml">[/URL]
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body leftmargin="0" topmargin="0">
<table width="580" height="402" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td valign="top"><form id="form1" name="form1" method="post" action="impamembers.asp">
      <label>Search
        <input type="text" name="textfield" />
        </label>
      <input type="submit" name="Submit" value="Submit" />
    </form>      <label></label></td>
  </tr>
</table>
</body>
</html>

Code of ASP page

Code:
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/impa.asp" -->
<%
var rsMembers__MMColParam = "1";
if (String(Request.QueryString("Company")) != "undefined" && 
    String(Request.QueryString("Company")) != "") { 
  rsMembers__MMColParam = String(Request.QueryString("Company"));
}
%>
<%
var rsMembers = Server.CreateObject("ADODB.Recordset");
rsMembers.ActiveConnection = MM_impa_STRING;
rsMembers.Source = "SELECT * FROM [IMPA Membership Database] WHERE Company LIKE '%"+ rsMembers__MMColParam.replace(/'/g, "''") + "%' ORDER BY Company ASC";
rsMembers.CursorType = 0;
rsMembers.CursorLocation = 2;
rsMembers.LockType = 1;
rsMembers.Open();
var rsMembers_numRows = 0;
%>
<%
var Repeat1__numRows = 10;
var Repeat1__index = 0;
rsMembers_numRows += Repeat1__numRows;
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/URL]
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml">[/URL]
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body leftmargin="0" topmargin="0">
<% while ((Repeat1__numRows-- != 0) && (!rsMembers.EOF)) { %>
  <table width="500" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td width="136">Company:</td>
      <td width="364"><%=(rsMembers.Fields.Item("Company").Value)%></td>
    </tr>
    <tr>
      <td>Name:</td>
      <td><%=(rsMembers.Fields.Item("Contact").Value)%></td>
    </tr>
    <tr>
      <td>Country:</td>
      <td><%=(rsMembers.Fields.Item("Country").Value)%></td>
    </tr>
    <tr>
      <td>Tel:</td>
      <td><%=(rsMembers.Fields.Item("Tel").Value)%></td>
    </tr>
    <tr>
      <td>Fax:</td>
      <td><%=(rsMembers.Fields.Item("Fax").Value)%></td>
    </tr>
    <tr>
      <td>Website:</td>
      <td><%=(rsMembers.Fields.Item("website").Value)%></td>
    </tr>
    <tr>
      <td>Membership:</td>
      <td><%=(rsMembers.Fields.Item("Membership").Value)%></td>
    </tr>
    <tr>
      <td>Profile:</td>
      <td>&nbsp;</td>
    </tr>
  </table>
  <%
  Repeat1__index++;
  rsMembers.MoveNext();
}
%>
</body>
</html>
<%
rsMembers.Close();
%>
 
Just to make sure that the ASP page works, create a new one and just one line of code:
Code:
<% Response.Write "Hello World" %>
If that works, then the problem is in your code. But your error message isn't very clear. Check to make sure that "Show Friendly HTTP Error Messages" is unchecked and then see what error messages you receive.

------------------------------------------------------------------------------------------------------------------------
"Men occasionally stumble over the truth, but most of them pick themselves up and hurry off as if nothing ever happened."
- Winston Churchill
 
Its all working now it was a server side issue thank you for ur time :)
 
Out of curiosity (others may have a similar problem in the future), what was the problem and how was it fixed?

------------------------------------------------------------------------------------------------------------------------
"Men occasionally stumble over the truth, but most of them pick themselves up and hurry off as if nothing ever happened."
- Winston Churchill
 
It was something to do with the webpage not locating the database or the database source so a technician where the server is held changed something, he didnt go into great detail which is annoying cause i would of liked to know!

Probably not very helpful but thats what i was told.

Another mistake i noticed though was that the search field was not referenced properly in the recordset and once changed it all worked fine.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top