sirWimelef Posted February 27, 2008 Posted February 27, 2008 (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 February 28, 2008 by sirWimelef
sirWimelef Posted February 28, 2008 Author Posted February 28, 2008 (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 February 28, 2008 by sirWimelef
ResNullius Posted February 29, 2008 Posted February 29, 2008 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now