|
-
Mar 17th, 2002, 11:59 AM
#1
Thread Starter
Addicted Member
Recordset Loops
Hi everyone,
Below is a piece of ASP code that I have written, however, whenever I execute it, I get errors saying :
"Object doesn't support this property or method: 'EOF' "
And I can't figure out whats wrong!
Does anyone have any ideas?
Code:
Dim strDivConn, divConnString, divRecordset
Set strDivConn = Server.CreateObject("ADODB.Connection")
divConnString = "DRIVER={Microsoft Access Driver (*.mdb)};" & _
"DBQ=" & Session("prjLocation") & "\db\data.mdb" & ";"
strDivConn.Open(divConnString)
divRecordset = strDivConn.Execute ("SELECT * FROM tbl_Divisions;")
do until divRecordSet.EOF
response.write ("<p><input type=radio value='" & divRecordset("divID") & "' name=divID>")
response.write (divRecordset("divName") & vbCrLf)
divRecordset.MoveNext
loop
Adam
P.S. If I remove the DO...LOOP and MoveNext, the code prints the first record fine, it just seems that it cannot run the loop properly!
-
Mar 17th, 2002, 09:31 PM
#2
Re: Recordset Loops
Not sure if this is the problem
but try creating the Recordset object explicitly
eg.
set divRecordset = Server.CreateObject("ADODB.Connection")
[VBF RSS Feed]
There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.
If I have been helpful, Please Rate my Post. Thanks.
This post was powered by : 
-
Mar 18th, 2002, 03:21 AM
#3
Fanatic Member
try this,
Dim strDivConn, divConnstring, divRecordset
Set strDivConn = Server.CreateObject("ADODB.Connection")
divConnString = "DRIVER={Microsoft Access Driver (*.mdb)};" & _
"DBQ=" & Session("prjLocation") & "\db\data.mdb" & ";"
strDivConn.Open(divConnString)
set divRecordset = Server.CreateObject("ADODB.Recordset")
set divRecordset = strDivConn.Execute ("SELECT * FROM tbl_Divisions;")
do while not divRecordSet.EOF
response.write ("<p><input type=radio value='" & divRecordset("divID") & "' name=divID>")
response.write (divRecordset("divName") & vbCrLf)
divRecordset.MoveNext
loop
If a post has helped you then Please Rate it!
-
Mar 18th, 2002, 10:23 AM
#4
Frenzied Member
You don't need:
Code:
set divRecordset = Server.CreateObject("ADODB.Recordset")
If you are creating the rs from the return of a .execute method. Be aware however, that you are creating a read only, forward only recordset when you create it in this way.
oOOo--oOOo
__ /\/\onte96
oOOo--oOOo
Senior Programmer/Analyst
MCP
[email protected]
[email protected]
Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|