Sign in to follow this  
Followers 0
sirWimelef

mssql recordset errors

3 posts in this topic

#1 ·  Posted (edited)

im trying to make a simple interface for some sql querys that we use every day but i have a littel problem with the comands .rowCount .columnCount y .columnname if i try tu use any of these always i get the same error

the afected part of the scrip is this:

Func conectmssql()
    $sqlCon = ObjCreate("ADODB.Connection")
    $sqlCon.Open("Provider=SQLOLEDB; Data Source=192.9.200.6; User ID=mdbusr; Password=******;")
    Return $sqlCon
EndFunc
    $conn=conectmssql()
    $rs=$conn.Execute("SELECT * FROM MVXJDTA.CSYUSR WHERE CRCONO = 444") 
    $y=$rs.rowCount
    $x=$rs.columnCount
    dim $rstitels[$x-1]
    dim $i=0
    While  $i<$x
        $rstitels[$i]=$rs.columnName($i)
        $i=$i+1
    WEnd

and the error is

_ArrayDisplay.au3 (15) : ==> The requested action with this object has failed.: 
$y=$rs.rowCount 
$y=$rs.rowCount^ ERROR
----------
$x=$rs.columnCount 
$x=$rs.columnCount^ ERROR
----------
$rstitels[$i]=$rs.columNname($i) 
$rstitels[$i]=$rs.columNname($i)^ ERROR

any ideas ? or some other way to get how many columns and rows have de recordset and the name of each column?

Edited by sirWimelef

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

well, i can belive that any one never got a problems with sql recodsets :) .

after thinking some other posibilitis i try to made somthing like this:

$Y=0
          While 1   
                $a=$data.fieldS($y).value       
                If @error Then Exitloop
                $y=$y+1
          WEnd
$ncolums=$y

but it give me this error, i want that give an error but not to terminate the program only to exit the loop

==> The requested action with this object has failed.: 
$a=$data.fieldS($y).value 
$a=$data.fieldS($y)^ ERROR

there are any way to solve this?

Edited by sirWimelef

Share this post


Link to post
Share on other sites

well, i can belive that any one never got a problems with sql recodsets :) .

after thinking some other posibilitis i try to made somthing like this:

$Y=0
          While 1   
                $a=$data.fieldS($y).value       
                If @error Then Exitloop
                $y=$y+1
          WEnd
$ncolums=$y

but it give me this error, i want that give an error but not to terminate the program only to exit the loop

==> The requested action with this object has failed.: 
$a=$data.fieldS($y).value 
$a=$data.fieldS($y)^ ERROR

there are any way to solve this?

A custom error handler might help diagnose further.

See COM Error Handling under Obj/COM Reference in the helpfile

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  
Followers 0