Creates an instance of DbNeData without provider information
Namespace:
DbNetLink.DataAssembly: DbNetLink.DbNetData (in DbNetLink.DbNetData.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
| C# |
|---|
public DbNetData( string ConnectionString ) |
| Visual Basic (Declaration) |
|---|
Public Sub New ( _ ConnectionString As String _ ) |
| Visual C++ |
|---|
public: DbNetData( String^ ConnectionString ) |
Parameters
- ConnectionString
- Type: System..::.String
Connection string
Remarks
The provider is derived on the following basis:
- If the connection string matches the regular expression "Provider=.*oledb.*;" then the OleDb data provider is used
- If the connection string matches the regular expression "dsn=.*" then the Odbc data provider is used
- If the connection string matches the regular expression "Data Source=(.*)\.vdb3;" then the VistaDB data provider is used
- If the connection string matches the regular expression "Data Source=(.*)\.fdb;" then the Firebird data provider is used
- If the connection string matches none of the above then the SqlClient data provider is used
Examples
DbNetData Db = new DbNetData("Server=dbserver;Database=Northwind;Trusted_Connection=true;");
DbNetData Db = new DbNetData("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\data\hr.mdb");
// Speciying the data provider in the connection string DbNetData Db = new DbNetData("Data Source=Employees;user id=scott;password=tiger;DataProvider=OracleClient;");
// You can also simply provide the key for a <connectionStrings> entry in the web.config entry DbNetData Db = new DbNetData("nwind");