ProviderString database parameter
Description
A string containing provider-specific extended connection
information. Use of this database parameter requires that you know
how this string will be interpreted and used by the provider. You
should use this parameter only for provider-specific connection
information that cannot be explicitly described by other database
parameters.
When to specify ProviderString
You must specify the ProviderString parameter before connecting
to the database.
Controls
-
ADO.NET
-
OLE DB
-
SNC SQL Native Client for Microsoft SQL Server
Syntax
|
1 |
ProviderString='<span>value</span>' |
Default
None
Usage
OLE DB applications can initialize data source objects using
two methods: IDBInitialize::Initialize and IDataInitialize::GetDataSource.
Using IDBInitialize::Initialize, a provider
string can be used to initialize connection properties by setting
the DBPROP_INIT_PROVIDERSTRING property in the
DBPROPSET_DBINIT property set. An initialization string can
also be passed to the IDataInitialize::GetDataSource method
to initialize connection properties.
For the OLE DB interface, the ProviderString parameter is
used with IDBInitialize::Initialize. For the SNC interface, the ProviderString
parameter is used with IDataInitialize::GetDataSource.
Both methods initialize the same OLE DB connection properties,
but they use different sets of keywords. For lists of keywords,
see the information about OLE DB provider connection string keywords
in the Microsoft documentation
.
Examples
Since Microsoft SQL Server
supports multiple instances of a database on a single server, you
must identify the specific database to which you want to connect
by entering the database name. For the ADO.NET and SNC interfaces, you should set the
Database parameter on the Connection page in the Database Profile
Setup dialog box. For OLE DB, you can use the ProviderString parameter.
To identify a specific Microsoft SQL Server
database named ts3:
-
Database profile
Enter the following in the Extended Properties box on the
Connection page in the Database Profile Setup dialog box for OLE DB:1Database=ts3 -
Application
Type the following in code for an OLE DB connection:
1SQLCA.DbParameter="ProviderString='database=ts3'"