How come I always get a server script time out with the following code ? My Access database has only 10 records ?
<!--#include file="../../MyIncludes/Top_Survey.inc" -->
<%
if Session("LoggedIn") = "" then
Response.redirect "login.asp"
end if
%>
<%
'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim rsGuestbook 'Holds the recordset for the records in the database
Dim strSQL 'Holds the SQL query for the database
dim IntNumber
'Create an ADO connection odject
Set adoCon = Server.CreateObject("ADODB.Connection")
'Set an active connection to the Connection object using a DSN-less connection
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("Survey.mdb")
'Set an active connection to the Connection object using DSN connection
'adoCon.Open "DSN=guestbook"
'Create an ADO recordset object
Set rsGuestbook = Server.CreateObject("ADODB.Recordset")
'Initialise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT tblComments.* FROM tblComments;"
'Open the recordset with the SQL query
rsGuestbook.Open strSQL, adoCon
Response.Write ("<br>")
Response.Write ("<center>")
Response.Write ("<table border=1 id=table1 bordercolor=#C8DDCA align=center>")
Response.Write ("<tr>")
Response.Write ("<th width=80 align=center>")
Response.Write ("<B>")
Response.Write ("<font color=#2d5c3d size=+1 >")
Response.Write ("Number")
Response.Write ("</font>")
Response.Write ("</B>")
Response.Write ("</th>")
Response.Write ("<th width=25% align=center>")
Response.Write ("<font color=#2d5c3d size=+1 >")
Response.Write ("Password")
Response.Write ("</font>")
Response.Write ("</th>")
Response.Write ("<th width=25% align=center>")
Response.Write ("<font color=#2d5c3d size=+1 >")
Response.Write ("Answer")
Response.Write ("</font>")
Response.Write ("</th>")
Response.Write ("<th width=100 align=center>")
Response.Write (" ")
Response.Write ("</th>")
Response.Write ("<th width=100 align=center>")
Response.Write (" ")
Response.Write ("</th>")
Response.Write ("</tr>")
'Loop through the recordset
Do While not rsGuestbook.EOF
'Write the HTML to display the current record in the recordset
if IntNumber = "" then
IntNumber = 1
else
IntNumber = IntNumber + 1
end if
Response.Write ("<tr>")
Response.Write ("<td width=80 align=center>")
Response.Write ("<B>")
Response.Write (IntNumber)
Response.Write ("</B>")
Response.Write ("</td>")
Response.Write ("<td width=25% align=center>")
Response.Write (rsGuestbook("Name"))
Response.Write ("</td>")
Response.Write ("<td width=25% align=center>")
Response.Write (rsGuestbook("Comments"))
Response.Write ("</td>")
Response.Write ("<td width=100 align=center>")
Response.Write ("<a href=""Script_Delete.asp?ID=" & rsGuestbook("ID_no") & """>")
Response.Write ("Delete entry")
Response.Write ("</a>")
Response.Write ("</td>")
Response.Write ("<td width=100 align=center>")
Response.Write ("<a href=""update_form.asp?ID=" & rsGuestbook("ID_no") & """>")
Response.Write ("Update entry")
Response.Write ("</a>")
Response.Write ("</td>")
Response.Write ("</tr>")
'Move to the next record in the recordset
rsGuestbook.MoveNext
Loop
Response.Write ("</table>")
Response.Write ("</center>")
'Reset server objects
rsGuestbook.Close
Set rsGuestbook = Nothing
Set adoCon = Nothing
%>
<!--#include file="../../MyIncludes/Top_Survey.inc" -->
<%
if Session("LoggedIn") = "" then
Response.redirect "login.asp"
end if
%>
<%
'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim rsGuestbook 'Holds the recordset for the records in the database
Dim strSQL 'Holds the SQL query for the database
dim IntNumber
'Create an ADO connection odject
Set adoCon = Server.CreateObject("ADODB.Connection")
'Set an active connection to the Connection object using a DSN-less connection
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("Survey.mdb")
'Set an active connection to the Connection object using DSN connection
'adoCon.Open "DSN=guestbook"
'Create an ADO recordset object
Set rsGuestbook = Server.CreateObject("ADODB.Recordset")
'Initialise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT tblComments.* FROM tblComments;"
'Open the recordset with the SQL query
rsGuestbook.Open strSQL, adoCon
Response.Write ("<br>")
Response.Write ("<center>")
Response.Write ("<table border=1 id=table1 bordercolor=#C8DDCA align=center>")
Response.Write ("<tr>")
Response.Write ("<th width=80 align=center>")
Response.Write ("<B>")
Response.Write ("<font color=#2d5c3d size=+1 >")
Response.Write ("Number")
Response.Write ("</font>")
Response.Write ("</B>")
Response.Write ("</th>")
Response.Write ("<th width=25% align=center>")
Response.Write ("<font color=#2d5c3d size=+1 >")
Response.Write ("Password")
Response.Write ("</font>")
Response.Write ("</th>")
Response.Write ("<th width=25% align=center>")
Response.Write ("<font color=#2d5c3d size=+1 >")
Response.Write ("Answer")
Response.Write ("</font>")
Response.Write ("</th>")
Response.Write ("<th width=100 align=center>")
Response.Write (" ")
Response.Write ("</th>")
Response.Write ("<th width=100 align=center>")
Response.Write (" ")
Response.Write ("</th>")
Response.Write ("</tr>")
'Loop through the recordset
Do While not rsGuestbook.EOF
'Write the HTML to display the current record in the recordset
if IntNumber = "" then
IntNumber = 1
else
IntNumber = IntNumber + 1
end if
Response.Write ("<tr>")
Response.Write ("<td width=80 align=center>")
Response.Write ("<B>")
Response.Write (IntNumber)
Response.Write ("</B>")
Response.Write ("</td>")
Response.Write ("<td width=25% align=center>")
Response.Write (rsGuestbook("Name"))
Response.Write ("</td>")
Response.Write ("<td width=25% align=center>")
Response.Write (rsGuestbook("Comments"))
Response.Write ("</td>")
Response.Write ("<td width=100 align=center>")
Response.Write ("<a href=""Script_Delete.asp?ID=" & rsGuestbook("ID_no") & """>")
Response.Write ("Delete entry")
Response.Write ("</a>")
Response.Write ("</td>")
Response.Write ("<td width=100 align=center>")
Response.Write ("<a href=""update_form.asp?ID=" & rsGuestbook("ID_no") & """>")
Response.Write ("Update entry")
Response.Write ("</a>")
Response.Write ("</td>")
Response.Write ("</tr>")
'Move to the next record in the recordset
rsGuestbook.MoveNext
Loop
Response.Write ("</table>")
Response.Write ("</center>")
'Reset server objects
rsGuestbook.Close
Set rsGuestbook = Nothing
Set adoCon = Nothing
%>