Showing posts with label sqlserver. Show all posts
Showing posts with label sqlserver. Show all posts

Thursday, March 22, 2012

oleDBConnection not recognizing Database

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

--
Axiom Software, Ltd.
400 Columbus Ave
Valhalla, NY 10595
(914) 769-8800My Data Source is a machine name. SQL server uses SQL Server and Windows
authentication.

"Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> wrote in message
news:eURxE2WbDHA.1816@.TK2MSFTNGP09.phx.gbl...
> The actual message is "SQL Does not exist or access is denied." It could
be
> one or the other. First, your "Data Source" declaration - Is that a
machine
> name there? It has to be either a machine name, domain name, or an IP
> address of the machine hosting the SQL Server. Is it? If so, what
> authentication method is the server using?
> --
> HTH,
> Kevin Spencer
> Microsoft MVP
> .Net Developer
> http://www.takempis.com
> The more I learn, the less I know.
> "Roger Cantillo" <rogerc@.axiomsw.com> wrote in message
> news:eeuV2VWbDHA.3748@.TK2MSFTNGP11.phx.gbl...
> > 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
> > --
> > Axiom Software, Ltd.
> > 400 Columbus Ave
> > Valhalla, NY 10595
> > (914) 769-8800
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.

"Roger Cantillo" <rogerc@.axiomsw.com> wrote in message
news:evhdEuZbDHA.1180@.TK2MSFTNGP11.phx.gbl...
> My Data Source is a machine name. SQL server uses SQL Server and Windows
> authentication.
>
>
> "Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> wrote in message
> news:eURxE2WbDHA.1816@.TK2MSFTNGP09.phx.gbl...
> > The actual message is "SQL Does not exist or access is denied." It could
> be
> > one or the other. First, your "Data Source" declaration - Is that a
> machine
> > name there? It has to be either a machine name, domain name, or an IP
> > address of the machine hosting the SQL Server. Is it? If so, what
> > authentication method is the server using?
> > --
> > HTH,
> > Kevin Spencer
> > Microsoft MVP
> > .Net Developer
> > http://www.takempis.com
> > The more I learn, the less I know.
> > "Roger Cantillo" <rogerc@.axiomsw.com> wrote in message
> > news:eeuV2VWbDHA.3748@.TK2MSFTNGP11.phx.gbl...
> > > 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
> > > > --
> > > Axiom Software, Ltd.
> > > 400 Columbus Ave
> > > Valhalla, NY 10595
> > > (914) 769-8800
> >