WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

ADO DAO
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

SQLOLEDB Provider Error


Question:

I'm trying to connect to my organization's SQL server by using the SQLOLEDB Provider, this is the exact code Im using:
objDBConnection = ObjectOpen('ADODB.Connection')
objDBConnection.Open "Provider=sqloledb; Data Source=SRVSQL; Initial Catalog=TestDB; User ID=sa; Password=sa;"
Message("", "All Done!")
objDBConnection.Close
I'm getting the following error message:
Ole Exception:
Data source name not found and no default driver specified.
I wrote the same code (with a few minor syntax changes) in vbs and it works great. I love winbatch, what am I missing??? Any help would be greatly appreciated.

Answer:

You are missing parenthesis around the parameters in the Open Method
objDBConnection.Open("Provider=sqloledb; Data Source=SRVSQL; Initial Catalog=TestDB; User ID=sa; Password=sa;")

Article ID:   W17115
File Created: 2007:07:03:14:28:22
Last Updated: 2007:07:03:14:28:22