...

View Full Version : Little More Help Please



charlieb
09-03-2004, 08:31 AM
I keep getting this error message:

ADODB.Field error '800a0bcd'

Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.

/projectors/u2.asp, line 30



Here is the code:



<%

Response.Buffer = True

' Projector to retrieve
Dim pName
pName = Request.Form("ProjectorList1")
Dim pName2
pName2 = Request.Form("ProjectorList2")

' If Len(ProjectorName) < 1 Then
' ProjectorName = NONE
' End If

' If Len(ProjectorName2) < 1 Then
' ProjectorName2 = NONE
' End If


' Connection string
Dim connStr
connStr = "dsn=mrres88d;uid=88klg;pwd=55666k;network=d4b876cn"

' Recordset object
Dim rs
Set rs = Server.CreateObject("ADODB.Recordset")

rs.Open "select * from screenshots where ProjectorName = '" & replace(pName,"'","''") & "'", connStr, 3, 4

pjProjectorName = rs("ProjectorName")
pjAuthor = rs("Author")
pjProjectorDescription = rs("ProjectorDescription")
pjScreen = rs("Screen")
pjFileName1 = rs("FileName1")
pjFileName2 = rs("FileName2")
pjFileName3 = rs("FileName3")
pjFileName4 = rs("FileName4")

%>
<html>

<head>
<base target="contents">
</head>

<body topmargin="0" leftmargin="0" text="#000000" bgcolor="#FEE79E">

<%
rs.Close
Set rs = Nothing

Dim rs2
Set rs2 = Server.CreateObject("ADODB.Recordset")

rs2.Open "select * from screenshots where ProjectorName = '" & replace(pName2,"'","''") & "'", connStr, 3, 4


%>

<form method="POST" action="ProjectorsMain2.asp">
<table border="1" width="772" height="118">
<tr>
<td width="399" height="12">
<font size="1" face="Arial"><b>Projector:&nbsp;
<select size="1" name="ProjectorList1">
<option selected><%= Response.Write(pjProjectorName)%></option>
</select>

</b></font></td>
<td width="388" height="12"><font size="1" face="Arial"><b>Projector:&nbsp;
<select size="1" name="ProjectorList2">
<option selected><%= rs("ProjectorName2")%></option>
</select> &nbsp; <input type="submit" value="Submit" name="B1"></form>
</b></font>
</td>
</tr>
<tr>
<td width="399" height="67"><font size="1" face="Arial"><b>Author:&nbsp;<%= Response.Write(pjAuthor)%><br>
Description:&nbsp;&nbsp;<%= Response.Write(pjProjectorDescription)%></b></font></td>
<td width="388" height="67"><font size="1" face="Arial"><b>Author:&nbsp;<%= rs2("Author")%>
<br>
Description:&nbsp;&nbsp;<%= rs2("ProjectorDescription")%>
</b></font></td>
</tr>
<tr>
<td width="399" height="39"><b><font size="1" face="Arial">Screen:&nbsp;<%= Response.Write(pjScreen)%><span style="position: absolute; left: 207; top: 105"><a href="<%=Response.Write(pjFileName1)%>" target="contents"><img border="2" src="PICT0005_small1.JPG" alt="PICT0005.JPG (76099 bytes)" width="35" height="27"></a></span><span style="position: absolute; left: 253; top: 105"><a href="<%=Response.Write(pjFileName2)%>" target="contents"><img border="2" src="PICT0005_small1.JPG" alt="PICT0005.JPG (76099 bytes)" width="35" height="27"></a></span><span style="position: absolute; left: 342; top: 105"><a href="<%=Response.Write(pjFileName3)%>" target="contents"><img border="2" src="PICT0005_small1.JPG" alt="PICT0005.JPG (76099 bytes)" width="35" height="27"></a></span><br>
Screenshots (click to enlarge)</font></b><span style="position: absolute; left: 298; top: 105"><b><font size="1" face="Arial"><a href="<%=Response.Write(pjFileName4)%>" target="contents"><img border="2" src="PICT0005_small1.JPG" alt="PICT0005.JPG (76099 bytes)" width="35" height="27"></a></font></b></span></td>
<td width="388" height="39">
<font size="1" face="Arial"><b>Screen:&nbsp;<%= rs2("Screen")%><span style="position: absolute; left: 592; top: 106"><a href="PICT0005.JPG" target="main"><img border="2" src="PICT0005_small1.JPG" alt="PICT0005.JPG (76099 bytes)" width="35" height="27"></a></span><br>
Screenshots (click to enlarge)<span style="position: absolute; left: 635; top: 106"><a href="PICT0005.JPG" target="main"><img border="2" src="PICT0005_small1.JPG" alt="PICT0005.JPG (76099 bytes)" width="35" height="27"></a></span><span style="position: absolute; left: 723; top: 106"><a href="PICT0005.JPG" target="main"><img border="2" src="PICT0005_small1.JPG" alt="PICT0005.JPG (76099 bytes)" width="35" height="27"></a></span><span style="position: absolute; left: 679; top: 106"><a href="PICT0005.JPG" target="main"><img border="2" src="PICT0005_small1.JPG" alt="PICT0005.JPG (76099 bytes)" width="35" height="27"></a></span></b></font>
</td>
</tr>
</table>


</body>

</html>

<%

rs2.Close
Set rs2 = Nothing
Set connStr = Nothing
%>



Again Any Help Is Appreciated

glenngv
09-03-2004, 12:01 PM
The error means that you access a field in the recordset when there is nothing in the recordset. So before you access a field, make sure that the recordset has records in it.


rs.Open "select * from screenshots where ProjectorName = '" & replace(pName,"'","''") & "'", connStr, 3, 4

if not rs.BOF and not rs.EOF then 'there are records in the recordset
pjProjectorName = rs("ProjectorName")
pjAuthor = rs("Author")
pjProjectorDescription = rs("ProjectorDescription")
pjScreen = rs("Screen")
pjFileName1 = rs("FileName1")
pjFileName2 = rs("FileName2")
pjFileName3 = rs("FileName3")
pjFileName4 = rs("FileName4")
else 'no records
rs.Close
Set rs = Nothing
response.write "Record not found."
response.end
end if

charlieb
09-03-2004, 03:12 PM
Thanks Glen but the fields in this sql server database are all filled. I can't figure out why the message keeps poping up

fractalvibes
09-03-2004, 03:28 PM
1.) Make your sql a variable:
sqlstring = "select * from screenshots where ProjectorName = '" and so forth.

2.) response.write sqlstring
response.end
to see what you are actually sending the DB

3.) If the sqlstring looks ok (all variables ok also)
do the rs,open
response.write rs.RecordCount
response.end
to see if you are acually returning anything

THat is the starting point to tracking your problem down

fv

miranda
09-03-2004, 03:35 PM
Glens answer is what the error is telling you. Now, since you say there are records in the database you need to do a response.write on your SQL query and see what you come up with.


Response.write "select * from screenshots where ProjectorName = '" & replace(pName,"'","''") & "'"
rs.Open "select * from screenshots where ProjectorName = '" & replace(pName,"'","''") & "'", connStr, 3, 4

if not rs.BOF and not rs.EOF then 'there are records in the recordset
pjProjectorName = rs("ProjectorName")
pjAuthor = rs("Author")
pjProjectorDescription = rs("ProjectorDescription")
pjScreen = rs("Screen")
pjFileName1 = rs("FileName1")
pjFileName2 = rs("FileName2")
pjFileName3 = rs("FileName3")
pjFileName4 = rs("FileName4")
else 'no records
rs.Close
Set rs = Nothing
response.write "Record not found."
response.end
end if

charlieb
09-03-2004, 05:29 PM
Thanks everyone, I will try this advice in little while. I'm keeping an eye on Hurricane Francis (I live in Miami, Fl) and still doing some last minute preparation.

charlieb
09-04-2004, 06:11 AM
I checked the sql and corrected the problem but I am still having a problem passing variables from a drop down menu (on one asp page) to the top (or banner) page of a frameset. I am still new to all this and perhaps I don't understand how the frameset works. The page at the top of the frameset is u2.asp and the frameset is ProjectorsMain2.asp The drop down menu is in a page called u.asp. Should action= (in the form in u.asp) be u2.asp, which will only call up that page and not the frameset or ProjectorsMain2.asp, which will call up the frameset but doesnt seem to work. I just get an error message in the top page (banner) in the frame set.

This is the link to u.asp: http://greatad.com/projectors/u.asp I know that the code will work if I set action="u2.asp" in u.asp form, but the error message you see is when I set action="ProjectorsMain2.asp" in u.asp form. The error message you see is in the frame for u2.asp. Any ideas?

miranda
09-04-2004, 04:28 PM
To do what you are trying to do requires that you pass the variable on to your u2.asp page. but if you do a response.write on each of the variables you will see that they are empty. Now one way to pass this on to the u2 page is to include the values inside the url. So make this change to your frames page ProjectorsMain2.asp


<%
Dim pName, pName2
pName = Request.Form("ProjectorList1")
pName2 = Request.Form("ProjectorList2")
%>
<frameset rows="145,*">
<frame name="banner" scrolling="no" noresize target="contents" src="u2.asp?ProjectorList1=<%=pName%>&ProjectorList2=<%=pName2%>">


Now since you are sending the variables in the url you need to change your u2.asp page accordingly.



Dim pName, pName2
pName = Request.QueryString("ProjectorList1")
pName2 = Request.QueryString("ProjectorList2")


That should solve that problem for you. Now all you have to worry about is Frances.

charlieb
09-04-2004, 07:59 PM
Thanks I really appreciate all the great advice, I'll try that as soon as the power comes back on. I am using a computer at my dads' house. They are lucky enough to have power for the time being. This #%! hurricane is just hanging around and won't go away.

charlieb
09-07-2004, 02:13 AM
Thanks Miranda, works like a charm! :thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum