Jump to content
Sign in to follow this  
Ghost21

EOF on Database Issue

Recommended Posts

Ghost21

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.:

?

Share this post


Link to post
Share on other sites
PsaltyDS

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

Share this post


Link to post
Share on other sites
Ghost21

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

Share this post


Link to post
Share on other sites
PsaltyDS

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

Share this post


Link to post
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
Sign in to follow this  

×