oleDBConnection not recognizing Database

R

Roger Cantillo

Hi,
I'm using oleDBConnection to connect to SQL server. I keep getting "SQL
Server does not exist" on Open event.
The code I'm using is the following
Dim objConn As New OleDbConnection("Provider=SQLOLEDB;Data
Source=sqlserver;Database=db;User Id=user;Password=user;")


Can anyone help?

Roger
 
R

Roger Cantillo

My Data Source is a machine name. SQL server uses SQL Server and Windows
authentication.
 
K

Kevin Spencer

Try substituting "Initial Catalog" for "Database" in your Connection String.
Example:

"Provider=sqloledb;Data Source=MachineName;Initial Catalog=Databasename;User
Id=UserName;Password=UserPassword;"

If that doesn't work, one of a couple of things could be wrong:

1. The machine name is not recognized across the network. Try using an IP
address instead. And make sure that the SQL Server is using TCP/IP
2. Your User Name and/or Password are incorrectly typed
3. Your UserName account doesn't have permission to access the database

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
The more I learn, the less I know.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,521
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top