tamagogi Posted April 30, 2009 Share Posted April 30, 2009 Hi, I have a problem inside a query with sql server. When i execute and i success with data then all right. When the query have no data has result my project crash. I use this code: $conn = ObjCreate("ADODB.Connection") $DSN = "DRIVER={SQL Server};" & "SERVER=XX.XX.XX.XX\SQLEXPRESS;DATABASE=Test;UID=SA;PWD=password;" $rs = ObjCreate("ADODB.RecordSet") $conn.Open($DSN) $rs=$conn.EXECUTE("SELECT * from table where ....") if $rs.RecordCount<>0 Then MsgBox(1,"Found",$rs.Fields("value").Value) EndIf $rs.close $conn.close error is: The requested action with this object has failed.: $hQuery = $hConHandle.Execute($vQuery) $hQuery = $hConHandle.Execute($vQuery)^ ERROR thanks and sorry for my english Link to comment Share on other sites More sharing options...
ChrisL Posted April 30, 2009 Share Posted April 30, 2009 (edited) Have a look here at my UDF for SQL http://www.autoitscript.com/forum/index.php?showtopic=51952#It has an error handler to prevent hard crashes and provide feedback on the errors. Edited April 30, 2009 by ChrisL [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
tamagogi Posted May 6, 2009 Author Share Posted May 6, 2009 Many thanks Link to comment Share on other sites More sharing options...
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