Jump to content

EOF on Database Issue


Ghost21
 Share

Recommended Posts

If Not $oRS.EOF Then

$oRS.Movenext

Else

EndIf

Why does it keep crashing on EOF is the syntax wrong keep getting this error ==> The requested action with this object has failed.

Are you sure you have a valid record set object in $oRS?

:P

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Func stations()

Call("dbOpen")

$oRS.Open("SELECT * FROM stations", $oConn, 1, 3)

Local $statid

$statid = Random(0, $oRS.RecordCount, 1)

$count = $oRS.RecordCount

For $i = 1 To $count

If $statid = $i Then

$stationtype = $oRS.Fields("TYPE" ).value

$id = $oRS.Fields("STATIONID" ).value

$oldid = $id

MsgBox(0, "PC Station ID Found. :" & $statid, $stationtype & " : " & $id, 2)

Call("getdata", $id)

Call("dbClose")

Else

EndIf

If Not $oRS.EOF Then

$oRS.Movenext

Else

$oRS.MoveFirst

EndIf

Next

$id = ""

$stationtype = ""

Call("dbClose")

EndFunc

Link to comment
Share on other sites

Func stations()
    Call("dbOpen")
    $oRS.Open("SELECT * FROM stations", $oConn, 1, 3)
    Local $statid
    $statid = Random(0, $oRS.RecordCount, 1)
    $count = $oRS.RecordCount
    For $i = 1 To $count
        If $statid = $i Then
            $stationtype = $oRS.Fields("TYPE" ).value
            $id = $oRS.Fields("STATIONID" ).value
            $oldid = $id
            MsgBox(0, "PC Station ID Found. :" & $statid, $stationtype & " : " & $id, 2)
            Call("getdata", $id)
            Call("dbClose")
        Else
        EndIf
        If Not $oRS.EOF Then
            $oRS.Movenext
        Else
            $oRS.MoveFirst
        EndIf
    Next
    $id = ""
    $stationtype = ""
    Call("dbClose")
EndFunc
Aren't you doing 'Call("dbClose")' inside that IF condition before you try to use the record set? I assume "dbClose" closes the DB connection, and thereby invalidates the record set?

:P

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...