Jump to content

SQL SERVER Problem


Recommended Posts

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

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

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

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 by Pain
Link to comment
Share on other sites

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

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
Try add $oMyError.description

ConsoleWrite( "COM Error !" & @CRLF & _
               "Number is: " & $HexNumber & @CRLF & _
               "Description is: " & $oMyError.description  & @CRLF & _
               "Windescription is: " & $oMyError.windescription )
Link to comment
Share on other sites

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

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

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...