Connection String question

  • Thread starter Thread starter Rajesh Patel
  • Start date Start date
R

Rajesh Patel

I think, you are using sqlclient.sqlconnection that is specific to sqlserver
provider. no need to provide provider in such case.

Rajesh Patel
 
Hi !

I am trying to connect to sample Northwind MSDE database. I installed
it in default location (under Program Files/Microsoft SQL).

The following connection string works Ok:
String connString = "DATABASE=northwind;INTEGRATED
SECURITY=sspi;SERVER=(local)\\NetSDK;";

Whereas the following doesn't work:
string connString = "Provider=SQLOLEDB;Data
Source=(local)\\NetSDK;Initial
Catalog=Northwind;Trusted_Connection=Yes;";

I am getting "keyword not supported : provider" error.

What is the problem ?
How should I use Provider and Data Source propertys ?

Thanks in Advance.

Jean
 
If you are using the OLEDB provider, the second is fine. You do not specify
a provider with SqlClient, as it only works with SQL Server.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

**********************************************************************
Think Outside the Box!
**********************************************************************
 
I suspect that you are using the SqlClient namespace which does not accept a
provider name as it is its own provider.

If you want to be able to specify providers, you should use the
System.Data.OleDb namespace instead.
 
Yup. I expect you're using the SqlClient .NET Data Provider. It does not use
OLE DB providers and does not need (or recognize) the "Provider=" keyword.

hth

--
____________________________________
Bill Vaughn
MVP, hRD
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
This is a conceptual problem, the problem is understanding what the Provider
keyword does.

The Oledb managed provider is not a real provider, it is really a managed
wrapper for any Oledb native provider that you want to use. So if you want
to use the native SQLOLEDB provider from our managed wrapper you add this to
your connection string: Provider=SQLOLEDB. Using the wrapper for a different
native provider is as simple as pointing this provider keyword to the
appropriate provider name.

The SqlClient managed provider on the other hand is a real provider, not a
wrapper. The Provider keyword is not supported.

If you are using DataLinks this is an outdated component, hopefully there
will be a managed version of this arround at some point of time, for now
Visual Studio has hacked arround DataLinks by creating a Oledb SQLOLEDB
connection string and removing the provider keyword manually.

Hope this helped.
 
Back
Top