Results 1 to 4 of 4

Thread: Recordset Loops

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Posts
    181

    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!

  2. #2
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877

    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 :

  3. #3
    Fanatic Member VBKNIGHT's Avatar
    Join Date
    Oct 2000
    Location
    Port25
    Posts
    619
    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!

  4. #4
    Frenzied Member monte96's Avatar
    Join Date
    Sep 2000
    Location
    Somewhere in AZ
    Posts
    1,379
    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
  •  



Click Here to Expand Forum to Full Width