1) remove the smi-colon from the end of the SQL statement (I've not put them
there, but it may be OK).
2) check the data base for "rows" in the table, because you are telling it
to print the results BEFORE you verify that any rows were returned. I
suspect that you are not getting any rows returned.
From: Bob [mailto:bobage24@a...]
Sent: Tuesday, September 19, 2000 8:53 AM
To: Code Clinic
Subject: [proasp_codeclinic] Cannot Connect to Database (Same Problem)
OK, I think I got rid of the typos, but I am still having trouble with
getting the code right. Here is the Code:
<% OPTION EXPLICIT %>
<BASEFONT FACE="Comic Sans MS" COLOR="DarkBlue">
<TITLE>The Gym Directory - Adding Comments</TITLE>
<% 'This code works fine:::::
Dim rsItem, strItemName, strDescription, strAddress
Set rsItem = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT * FROM Gym WHERE ID =" & Request("Gym")
rsItem.Open strSQL, objConn
strItemName = rsItem("GymName")
strAddress = rsItem("Address")
strDescription = rsItem("Description")
Set rsItem = Nothing
'Here is where the problems start::::
Dim rsComments, strComments
Set rsComments = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT * FROM Comments WHERE ID =" & Request("Gym") & _
" ORDER BY TimeStamp DESC;"
rsComments.Open strSQL, objConn
Set strComments = rsComments("Comments")
Response.Write strComments "This line is causing an error which is
at the bottom of the page.
<CENTER><H1>The Gym Directory<BR>Adding comments to <%= strItemName
'This next section is still not working at all::::
If rsComments.EOF Then
Response.Write "So far no comments have been added."
"<TABLE BORDER=""2"" WIDTH=100% CELLSPACING=""3"">" & _
"<TR>" & _
" <TH>Comments</TH>" & _
" <TH>Added</TH>" & _
Do While Not rsComments.EOF
"<TR>" & _
" <TD>" & rsComments("Comments") & "</TD>" & _
" <TD>" & rsComments("TimeStamp") & "</TD>" & _
Set rsComments = Nothing
Now here is the error I am getting???? I get it when I do Response.Write
strComments. What does the error mean?? I am trying to get the Comments
for the Current gym listing and list them all on the page. I can't seem to
get it to work. Any help is greatly appreciated. Here is the error code I
am now getting:
ADODB.Field error '80020009'
Either BOF or EOF is True, or the current record has been deleted.
Requested operation requires a current record.