yaggy85
02-06-2009, 06:53 AM
Hi guys,
im trying to select all the records in my database, which have the "processed" field as "no".
my script below works with the following SQL line:
SQL = "Select * FROM " & tbl
but when i change it to this:
SQL = "Select * FROM " & tbl & " WHERE processed = " & pro
I change it to that so that instead of selecting all entries, it only selects the records where "processed" = "no"
I get the following error:
Select * FROM products WHERE processed = no
Sorry, no records were found. Back To Admin Mainproducts
ADODB.Recordset error '800a0bcd'
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
/com_1/delete32.asp, line 80
I don't understand what i'm doing wrong? i always response.write my sql so i know the SQL is ok. I'm thinking the error is coming from something in the main code where it sorts the entries into 200 per page..
Anyone able to help?
Cheers.
<%Response.Buffer=TRUE%>
<%IF session("admin") = FALSE THEN Response.Redirect "admin.asp"%>
<%
tbl = Request.QueryString("which")
If tbl = "products" Then
ttl = "products"
pro = Request.QueryString("processed")
Else
ttl = "Administrators"
End If
%>
<html>
<head>
<title>Delete <%=ttl%></title>
</head>
<body>
<%
'here is the connection string
Set conn = server.createobject("adodb.connection")
'this connection uses JET 4 it is the prefered method of connecting to an access database
DSNtemp = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath("/com_1/database/ra_db.mdb")
'if you cant use JET then comment out the line above and uncomment the line below
'DSNtemp="DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.Mappath("/com_1/database/ra_db.mdb")
conn.Open DSNtemp
SQL = "Select * FROM " & tbl & " WHERE processed = " & pro
response.write(sql)
pagetot = 200
const adOpenForwardOnly = 0
const adOpenKeySet = 1
const adOpenDynamic = 2
const adOpenStatic = 3
const adLockReadOnly = 1
const adLockPessimistic = 2
const adLockOptimistic = 3
const adLockBatchOptimistic = 4
Set RS = Server.CreateObject("Adodb.RecordSet")
RS.Open SQL, Conn, adopenkeyset, adlockoptimistic
If RS.EOF Then
%>
<table cellspacing=1 border=0 cellpadding=2 width="100%">
<tr>
<td> <font arial="arial" size="3" face="Trebuchet MS">Sorry, no records were
found. </font><font face="Trebuchet MS"><a href="admin2.asp">Back To Admin
Main</a></font><%=ttl%> </td>
</tr>
</table>
<%
ElseIf request("begin") = "" Then
begin = 1
Else
begin = Cint(request("begin"))
End If
tot = ((begin+pagetot)-1)
If tot > RS.RecordCount Then
tot = RS.RecordCount
End If
i = 1
navi = ""
For j = 1 to RS.RecordCount step pagetot
If j <> 1 Then navi = navi & " | "
If j = Cint(begin) Then
navi = navi & "<b>"&i&"</b>"
Else
navi = navi & "<a href="""
navi = navi & Request.ServerVariables("url") & "?begin=" & j & "&which=" & tbl
navi = navi & """>"
navi = navi & i & "</a>"
End If
i = i + 1
Next
i = 1
RS.Move begin - 1
%>
<h1><font face="Trebuchet MS" size="+3">View RA Requests - Processing Area</font></h1>
<p><a href="admin2.asp"><font face="Trebuchet MS">Back To Admin Main</font></a></p>
<table>
<table cellspacing=0 border=1 cellpadding=6 width="100%" bordercolorlight="#000000" bordercolordark="#000000">
<tr>
<th align=Left><font size="3" face="Trebuchet MS">Store Name</font></th>
<th align=Left><font size="3" face="Trebuchet MS">Store Phone</font></th>
<th align=Left><font size="3" face="Trebuchet MS">Store Email</font></th>
<th align=Left><font size="3" face="Trebuchet MS">Contact</font></th>
<th align=Left><font size="3" face="Trebuchet MS">Request Type</font></th>
<th align=Left><font size="3" face="Trebuchet MS">RA #</font></th>
<th align=center><font size="3" face="Trebuchet MS">Invoice</font></th>
<th align=center><font size="3" face="Trebuchet MS">Product Code</font></th>
<th align=center><font size="3" face="Trebuchet MS">Fault</font></th>
<th align=center><font size="3" face="Trebuchet MS">Time Requested</font></th>
<th align=center><font size="3" face="Trebuchet MS">Processed</font></th>
<th align=center><font size="3" face="Trebuchet MS">Action</font></th>
</tr>
<%
For x = begin to begin + (pagetot - 1)
If RS.EOF Then exit For
%>
<tr>
<td align=Left><font size="2"><%=RS("storename")%></font></td>
<td align=Left><font size="2"><%=RS("storephone")%></font></td>
<td align=Left><font size="2"><%=RS("storeemail")%></font></td>
<td align=Left><font size="2"><%=RS("contactname")%></font></td>
<td align=Left><font size="2"><%=RS("requesttype")%></font></td>
<td align=Left><font size="2"><%=RS("id")%></font></td>
<td align=Left><font size="2"><%=RS("invoice")%></font></td>
<td align=Left><font size="2"><%=RS("productcode")%></font></td>
<td align=Left><font size="2"><%=RS("fault")%></font></td>
<td align=Left><font size="2"><%=RS("time_requested")%></font></td>
<td align=Left><font size="2"><%=RS("processed")%></font></td>
<td align=center><a href="edit_ra_script2.asp?which=<%=tbl%>&id=<%=RS("id")%>"><font size="2" face="Trebuchet MS">Process</font></a></td>
<td align=center><a href="edit_ra_entry.asp?which=<%=tbl%>&id=<%=RS("id")%>"><font size="2" face="Trebuchet MS">Edit</font></a></td>
</tr>
<%
i = i + 1
RS.MoveNext
Next
%>
</table>
<table cellspacing="2" cellpadding="2" width=100%>
<tr>
<td align=right>
<b>
<font size="2">
<font face="Arial">
<%=ttl%> <%=begin%> - <%=tot%> of <%=RS.RecordCount%> Page:</font></font></b><font face="Arial"><font size="2"> <%=navi%></font>
</font>
</td>
</tr>
</table>
<%
RS.Close
Set RS = nothing
Conn.close
Set Conn = Nothing
%>
</body>
im trying to select all the records in my database, which have the "processed" field as "no".
my script below works with the following SQL line:
SQL = "Select * FROM " & tbl
but when i change it to this:
SQL = "Select * FROM " & tbl & " WHERE processed = " & pro
I change it to that so that instead of selecting all entries, it only selects the records where "processed" = "no"
I get the following error:
Select * FROM products WHERE processed = no
Sorry, no records were found. Back To Admin Mainproducts
ADODB.Recordset error '800a0bcd'
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
/com_1/delete32.asp, line 80
I don't understand what i'm doing wrong? i always response.write my sql so i know the SQL is ok. I'm thinking the error is coming from something in the main code where it sorts the entries into 200 per page..
Anyone able to help?
Cheers.
<%Response.Buffer=TRUE%>
<%IF session("admin") = FALSE THEN Response.Redirect "admin.asp"%>
<%
tbl = Request.QueryString("which")
If tbl = "products" Then
ttl = "products"
pro = Request.QueryString("processed")
Else
ttl = "Administrators"
End If
%>
<html>
<head>
<title>Delete <%=ttl%></title>
</head>
<body>
<%
'here is the connection string
Set conn = server.createobject("adodb.connection")
'this connection uses JET 4 it is the prefered method of connecting to an access database
DSNtemp = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath("/com_1/database/ra_db.mdb")
'if you cant use JET then comment out the line above and uncomment the line below
'DSNtemp="DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.Mappath("/com_1/database/ra_db.mdb")
conn.Open DSNtemp
SQL = "Select * FROM " & tbl & " WHERE processed = " & pro
response.write(sql)
pagetot = 200
const adOpenForwardOnly = 0
const adOpenKeySet = 1
const adOpenDynamic = 2
const adOpenStatic = 3
const adLockReadOnly = 1
const adLockPessimistic = 2
const adLockOptimistic = 3
const adLockBatchOptimistic = 4
Set RS = Server.CreateObject("Adodb.RecordSet")
RS.Open SQL, Conn, adopenkeyset, adlockoptimistic
If RS.EOF Then
%>
<table cellspacing=1 border=0 cellpadding=2 width="100%">
<tr>
<td> <font arial="arial" size="3" face="Trebuchet MS">Sorry, no records were
found. </font><font face="Trebuchet MS"><a href="admin2.asp">Back To Admin
Main</a></font><%=ttl%> </td>
</tr>
</table>
<%
ElseIf request("begin") = "" Then
begin = 1
Else
begin = Cint(request("begin"))
End If
tot = ((begin+pagetot)-1)
If tot > RS.RecordCount Then
tot = RS.RecordCount
End If
i = 1
navi = ""
For j = 1 to RS.RecordCount step pagetot
If j <> 1 Then navi = navi & " | "
If j = Cint(begin) Then
navi = navi & "<b>"&i&"</b>"
Else
navi = navi & "<a href="""
navi = navi & Request.ServerVariables("url") & "?begin=" & j & "&which=" & tbl
navi = navi & """>"
navi = navi & i & "</a>"
End If
i = i + 1
Next
i = 1
RS.Move begin - 1
%>
<h1><font face="Trebuchet MS" size="+3">View RA Requests - Processing Area</font></h1>
<p><a href="admin2.asp"><font face="Trebuchet MS">Back To Admin Main</font></a></p>
<table>
<table cellspacing=0 border=1 cellpadding=6 width="100%" bordercolorlight="#000000" bordercolordark="#000000">
<tr>
<th align=Left><font size="3" face="Trebuchet MS">Store Name</font></th>
<th align=Left><font size="3" face="Trebuchet MS">Store Phone</font></th>
<th align=Left><font size="3" face="Trebuchet MS">Store Email</font></th>
<th align=Left><font size="3" face="Trebuchet MS">Contact</font></th>
<th align=Left><font size="3" face="Trebuchet MS">Request Type</font></th>
<th align=Left><font size="3" face="Trebuchet MS">RA #</font></th>
<th align=center><font size="3" face="Trebuchet MS">Invoice</font></th>
<th align=center><font size="3" face="Trebuchet MS">Product Code</font></th>
<th align=center><font size="3" face="Trebuchet MS">Fault</font></th>
<th align=center><font size="3" face="Trebuchet MS">Time Requested</font></th>
<th align=center><font size="3" face="Trebuchet MS">Processed</font></th>
<th align=center><font size="3" face="Trebuchet MS">Action</font></th>
</tr>
<%
For x = begin to begin + (pagetot - 1)
If RS.EOF Then exit For
%>
<tr>
<td align=Left><font size="2"><%=RS("storename")%></font></td>
<td align=Left><font size="2"><%=RS("storephone")%></font></td>
<td align=Left><font size="2"><%=RS("storeemail")%></font></td>
<td align=Left><font size="2"><%=RS("contactname")%></font></td>
<td align=Left><font size="2"><%=RS("requesttype")%></font></td>
<td align=Left><font size="2"><%=RS("id")%></font></td>
<td align=Left><font size="2"><%=RS("invoice")%></font></td>
<td align=Left><font size="2"><%=RS("productcode")%></font></td>
<td align=Left><font size="2"><%=RS("fault")%></font></td>
<td align=Left><font size="2"><%=RS("time_requested")%></font></td>
<td align=Left><font size="2"><%=RS("processed")%></font></td>
<td align=center><a href="edit_ra_script2.asp?which=<%=tbl%>&id=<%=RS("id")%>"><font size="2" face="Trebuchet MS">Process</font></a></td>
<td align=center><a href="edit_ra_entry.asp?which=<%=tbl%>&id=<%=RS("id")%>"><font size="2" face="Trebuchet MS">Edit</font></a></td>
</tr>
<%
i = i + 1
RS.MoveNext
Next
%>
</table>
<table cellspacing="2" cellpadding="2" width=100%>
<tr>
<td align=right>
<b>
<font size="2">
<font face="Arial">
<%=ttl%> <%=begin%> - <%=tot%> of <%=RS.RecordCount%> Page:</font></font></b><font face="Arial"><font size="2"> <%=navi%></font>
</font>
</td>
</tr>
</table>
<%
RS.Close
Set RS = nothing
Conn.close
Set Conn = Nothing
%>
</body>