diegonella Posted October 1, 2008 Share Posted October 1, 2008 Good morning, I am trying to connect to a MSSQL Server Express 2005, I have tested with several examples and always gives me the same error The server is installed on the local PC @AutoItVersion: 3.2.12.1 C:\autoit\mssql2crm.au3 (30) : ==> The requested action with this object has failed.: $adCN.Open ("Driver={SQL Server};Server=local;Database=tempdb;Uid=sa;Pwd=mypassword;") $adCN.Open ("Driver={SQL Server};Server=local;Database=tempdb;Uid=sa;Pwd=mypassword;")^ ERROR >Exit code: 1 Time: 22.040 Any suggestions? Link to comment Share on other sites More sharing options...
Zedna Posted October 1, 2008 Share Posted October 1, 2008 Post more code. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
diegonella Posted October 1, 2008 Author Share Posted October 1, 2008 sorry this is code ConsoleWrite("@AutoItVersion: " & @AutoItVersion & @CR ) $adCN = ObjCreate ("ADODB.Connection") $adCN.Open ("Driver={SQL Server};Server=DIEGO;Database=mybase;Uid=sa;Pwd=diegonella;") Link to comment Share on other sites More sharing options...
DjDeep00 Posted October 1, 2008 Share Posted October 1, 2008 sorry this is code ConsoleWrite("@AutoItVersion: " & @AutoItVersion & @CR ) $adCN = ObjCreate ("ADODB.Connection") $adCN.Open ("Driver={SQL Server};Server=DIEGO;Database=mybase;Uid=sa;Pwd=diegonella;") @diegonella...You need to add a custom error handler... $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") $adCN = ObjCreate ("ADODB.Connection") $adCN.Open ("Driver={SQL Server};Server=DIEGO;Database=mybase;Uid=sa;Pwd=diegonella;") ;Rest of your code ; This is my custom error handler Func MyErrFunc() $HexNumber=hex($oMyError.number,8) Msgbox(0,"","We intercepted a COM Error !" & @CRLF & _ "Number is: " & $HexNumber & @CRLF & _ "Windescription is: " & $oMyError.windescription ) $g_eventerror = 1; something to check for when this function returns Endfunc Link to comment Share on other sites More sharing options...
Zedna Posted October 1, 2008 Share Posted October 1, 2008 sorry this is code ConsoleWrite("@AutoItVersion: " & @AutoItVersion & @CR ) $adCN = ObjCreate ("ADODB.Connection") $adCN.Open ("Driver={SQL Server};Server=DIEGO;Database=mybase;Uid=sa;Pwd=diegonella;") Code and also DSN string looks OK to me. So check COM error string as DjDeep00 said. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
diegonella Posted October 1, 2008 Author Share Posted October 1, 2008 Under this code ;BOF ConsoleWrite("@AutoItVersion: " & @AutoItVersion & @CR ) $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") $adCN = ObjCreate ("ADODB.Connection") $adCN.Open ("Driver={SQL Server};Server=DIEGO;Database=mybase;Uid=sa;Pwd=diegonella;") ;Rest of your code ; This is my custom error handler Func MyErrFunc() $HexNumber=hex($oMyError.number,8) ConsoleWrite( "COM Error !" & @CRLF & _ "Number is: " & $HexNumber & @CRLF & _ "Windescription is: " & $oMyError.windescription ) $g_eventerror = 1; something to check for when this function returns Endfunc ;EOF this is result COM Error ! Number is: 80020009 Windescription is: Error no especificado Link to comment Share on other sites More sharing options...
Pain Posted October 1, 2008 Share Posted October 1, 2008 (edited) You sure the driver is correct? Try something like this. Btw you will have to download driver 3.51 if you don't have it. $adCN.Open ("DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;DATABASE=test;UID=root;PWD=pass;PORT=3306") Edited October 1, 2008 by Pain Link to comment Share on other sites More sharing options...
diegonella Posted October 1, 2008 Author Share Posted October 1, 2008 You sure the driver is correct? Try something like this. Btw you will have to download driver 3.51 if you don't have it. $adCN.Open ("DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;DATABASE=test;UID=root;PWD=pass;PORT=3306") This is for MS-SQL Server or MySQL???? Link to comment Share on other sites More sharing options...
Zedna Posted October 1, 2008 Share Posted October 1, 2008 Under this code ;BOF ConsoleWrite("@AutoItVersion: " & @AutoItVersion & @CR ) $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") $adCN = ObjCreate ("ADODB.Connection") $adCN.Open ("Driver={SQL Server};Server=DIEGO;Database=mybase;Uid=sa;Pwd=diegonella;") ;Rest of your code ; This is my custom error handler Func MyErrFunc() $HexNumber=hex($oMyError.number,8) ConsoleWrite( "COM Error !" & @CRLF & _ "Number is: " & $HexNumber & @CRLF & _ "Windescription is: " & $oMyError.windescription ) $g_eventerror = 1; something to check for when this function returns Endfunc ;EOF this is result COM Error ! Number is: 80020009 Windescription is: Error no especificadoTry add $oMyError.description ConsoleWrite( "COM Error !" & @CRLF & _ "Number is: " & $HexNumber & @CRLF & _ "Description is: " & $oMyError.description & @CRLF & _ "Windescription is: " & $oMyError.windescription ) Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
mrider Posted October 1, 2008 Share Posted October 1, 2008 (edited) Is this your problem -> Microsoft Technet ?? On a side note, I came here after a long absence and had no idea there is a way to interact with MS SQL. I'm glad to see this post! [EDIT] I'm editing this post in response to the next post, since I don't want to artificially bump the thread. Probably NO. He has error on connection object not on recordset object (which is used later)Oh, yeah good point. NVM. Edited October 1, 2008 by mrider How's my riding? Dial 1-800-Wait-There Trying to use a computer with McAfee installed is like trying to read a book at a rock concert. Link to comment Share on other sites More sharing options...
Zedna Posted October 1, 2008 Share Posted October 1, 2008 Is this your problem -> Microsoft Technet ??Probably NO. He has error on connection object not on recordset object (which is used later) Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
diegonella Posted October 1, 2008 Author Share Posted October 1, 2008 Is this your problem -> Microsoft Technet ?? On a side note, I came here after a long absence and had no idea there is a way to interact with MS SQL. I'm glad to see this post! [EDIT] I'm editing this post in response to the next post, since I don't want to artificially bump the thread. Oh, yeah good point. NVM.but not yet point to any table, as to suppose that it is a kind of field with description @AutoItVersion: 3.2.12.1 COM Error ! Number is: 80020009 Description is: [Microsoft][ODBC SQL Server Driver][Shared Memory]Conexión no válida. Windescription is: Error no especificado 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