Ace08 Posted October 5, 2011 Share Posted October 5, 2011 Hi there i have this piece of code that works fine for small queries however i'm getting timeout expired on complex queries. $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") $conn = ObjCreate( "ADODB.Connection" ) $DSN = "DRIVER={SQL Server};SERVER=server;DATABASE=db;UID=User;PWD=Password2;" $conn.Open($DSN) $rs = ObjCreate( "ADODB.RecordSet" ) $rs.Open("select count(*) from table",$conn) $Inc = $rs.Fields(0).value $rs.close $rs.Open("select lname, fname, mname, school, address1, address2, city, state from table",$conn) Do If $rs.EOF() Then ExitLoop $cont = $cont & Chr(34) & $rs.Fields(0).value & Chr(34) & "," & Chr(34) & $rs.Fields(1).value & Chr(34) & "," & Chr(34) & $rs.Fields(2).value & Chr(34) & "," & Chr(34) & $rs.Fields(3).value & Chr(34) & "," & Chr(34) & $rs.Fields(4).value & Chr(34) & "," & Chr(34) & $rs.Fields(5).value & Chr(34) & "," & Chr(34) & $rs.Fields(6).value & Chr(34) & "," & Chr(34) & $rs.Fields(7).value & Chr(34) & @CRLF $rs.MoveNext() Until $rs.EOF() $rs.close MsgBox(0,"debug",$cont) Func MyErrFunc() Local $HexNumber $HexNumber=hex($oMyError.number,8) Msgbox(0,"COM Test","We intercepted a COM Error !" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $oMyError.description & @CRLF & _ "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _ "err.number is: " & @TAB & $HexNumber & @CRLF & _ "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _ "err.source is: " & @TAB & $oMyError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oMyError.helpcontext _ ) SetError(1) ; to check for after this function returns Exit Endfunc I've tried doing someting like $DSN = "DRIVER={SQL Server};SERVER=server;DATABASE=db;UID=User;PWD=Password2;Connection Timeout=0;" with no luck even tried doing $conn.ConnectionTimeout = 0 with same results Work smarter not harder.My First Posted Script: DataBase Link to comment Share on other sites More sharing options...
ChrisL Posted October 5, 2011 Share Posted October 5, 2011 have a look in my signature, there is a timeout function in there, see if you can use any of it to help [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...
Ace08 Posted October 5, 2011 Author Share Posted October 5, 2011 Thanks ChrisL will try this one and get back on you with this Work smarter not harder.My First Posted Script: DataBase 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