bandersen Posted July 15, 2009 Posted July 15, 2009 HiI have made a simpel database with Visual Web Developer. I have also added a SQL server connection in the ODBC Data Source Administrator, that points to the database. There is no login to the database, I am using the "Use Windows Authentication", to connect to the database.I have then made the following AutoIT test script just to connect to the databse:$oConn = ObjCreate("ADODB.Connection")$sqlCon.Open("DRIVER={SQL Server};SERVER=DK-263\SQLEXPRESS;DATABASE=RIS_SERVER_DATA;")if @error ThenMsgBox(0, "ERROR", "Failed to connect to the database")ExitElseMsgBox(0, "Success!", "Connection to database successful!")EndIfThen I get the following error:What is wrong with the connection?BRBenjamin Andersen
bandersen Posted July 15, 2009 Author Posted July 15, 2009 Hi Yes finally made it work With the following code: $conn = ObjCreate( "ADODB.Connection" ) $DSN = "DRIVER={SQL Server};SERVER=DK-263\SQLEXPRESS;DATABASE=RIS_SERVER_DATA;UID=;PWD=;" $conn.Open($DSN) $rs = ObjCreate( "ADODB.RecordSet" ) $rs.Open( "SELECT @@VERSION AS myVersion", $conn ) MsgBox(0, "AutoIT-SQL Result", "Value = " & $rs.Fields( "myVersion" ).Value ) $conn.close BR Benjamin Andersen
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