10:25:40
Like a dream @-01py
Http://bulo.163.com/article/-01py-MUWXHw.html
Copy
Comment
ASE. NET data provider
Mysqldirect. NET data provider
ODBC. NET data provider
Ole db. NET data provider
Oracle. NET data provider-from Microsoft
Oracle. NET data provider-from Oracle
Oradirect. NET data provider
Postgresqldirect. NET data provider
SQL Server. NET data provider
- Adaptive Server Enterprise (ASE)
. NET data provider
Sybase. Data. aseclient
The ASE. NET data provider is an add-on component to the. NET 1.1 framework that allows you to access a Sybase Adaptive Server Enterprise (ASE) database.
Using C #
using Sybase.Data.AseClient;
...
AseConnection oAseConn = new AseConnection();
oAseConn.ConnectionString = "Data Source=(local);" +
"Initial Catalog=myDatabaseName;" +
"User ID=myUsername;" +
"Password=myPassword"
oAseConn.Open();
Using VB.NET
Imports System.Data.AseClient
...
Dim oAseConn As AseConnection = New AseConnection()
oAseConn.ConnectionString = "Data Source=(local);" & _
"Initial Catalog=myDatabaseName;" & _
"User ID=myUsername;" & _
"Password=myPassword"
oAseConn.Open()
For more information, see: ASE User's Guide
- Mysqldirect. NET data provider
CoreLab. MySQL
The mysqldirect. NET data provider is an add-on component to
. NET framework that allows you to access the MySQL database using
Native MySQL network protocol or MYSQL client, without going through
Ole db or ODBC.
Using C #
using CoreLab.MySql;
MySqlConnection oMySqlConn = new MySqlConnection();
oMySqlConn.ConnectionString = "User ID=myUsername;" +
"Password=myPassword;" +
"Host=localhost;" +
"Port=3306;" +
"Database=myDatabaseName;" +
"Direct=true;" +
"Protocol=TCP;" +
"Compress=false;" +
"Pooling=true;" +
"Min Pool Size=0;" +
"Max Pool Size=100;" +
"Connection Lifetime=0";
oMySqlConn.Open();
Using VB. NET
Imports CoreLab.MySql
Dim oMySqlConn As MySqlConnection = New MySqlConnection()
oMySqlConn.ConnectionString = "User ID=myUsername;" & _
"Password=myPassword;" & _
"Host=localhost;" & _
"Port=3306;" & _
"Database=myDatabaseName;" & _
"Direct=true;" & _
"Protocol=TCP;" & _
"Compress=false;" & _
"Pooling=true;" & _
"Min Pool Size=0;" & _
"Max Pool Size=100;" & _
"Connection Lifetime=0"
oMySqlConn.Open()
For more information, see: CoreLab's mysqldirect. NET data provider
- ODBC. NET data provider
System. Data. ODBC
The Open Database Connectivity (ODBC). Net data provider is an add-on
Component to the. NET Framework. It provides access to native ODBC
Drivers the same way the ole db. NET data provider provides access
Native ole db providers.
Note: This technology is supported in version 1.1 of the. NET Framework. You need only download this, if you are running version 1.0.
For SQL Server ODBC driver
' VB.NET
Imports System.Data.Odbc
...
Dim oODBCConnection As OdbcConnection
Dim sConnString As String = _
"Driver={SQL Server};" & _
"Server=MySQLServerName;" & _
"Database=MyDatabaseName;" & _
"Uid=MyUsername;" & _
"Pwd=MyPassword"
oODBCConnection = New Odbc.OdbcConnection(sConnString)
oODBCConnection.Open()
For Oracle ODBC driver
' VB.NET
Imports System.Data.Odbc
...
Dim oODBCConnection As OdbcConnection
Dim sConnString As String = _
"Driver={Microsoft ODBC for Oracle};" & _
"Server=OracleServer.world;" & _
"Uid=myUsername;" & _
"Pwd=myPassword"
oODBCConnection = New Odbc.OdbcConnection(sConnString)
oODBCConnection.Open()
For access (JET) ODBC driver
' VB.NET
Imports System.Data.Odbc
...
Dim oODBCConnection As OdbcConnection
Dim sConnString As String = _
"Driver={Microsoft Access Driver (*.mdb)};" & _
"Dbq=c:/somepath/mydb.mdb;" & _
"Uid=Admin;" & _
"Pwd="
oODBCConnection = New Odbc.OdbcConnection(sConnString)
oODBCConnection.Open()
For sybase system 11 ODBC driver
' VB.NET
Imports System.Data.Odbc
...
Dim oODBCConnection As OdbcConnection
Dim sConnString As String = _
"Driver={Sybase System 11};" & _
"SRVR=mySybaseServerName;" & _
"DB=myDatabaseName;" & _
"UID=myUsername;" & _
"PWD=myPassword"
oODBCConnection = New OdbcConnection(sConnString)
oODBCConnection.Open()
For all other ODBC drivers
' VB.NET
Imports System.Data.Odbc
...
Dim oODBCConnection As OdbcConnection
Dim sConnString As String = "Dsn=myDsn;" & _
"Uid=myUsername;" & _
"Pwd=myPassword"
oODBCConnection = New Odbc.OdbcConnection(sConnString)
oODBCConnection.Open()
For more information, see: odbcconnection class and. NET data providers
To view Microsoft KB articles related to odbcconnection, click here
- Ole db. NET data provider
System. Data. oledb
The Microsoft. NET Framework data provider for ole db allow you to use
Native ole db providers (e.g. Microsoft. Jet. oledb.4.0) through COM
InterOP to enable data access.
The Microsoft. NET Framework data provider for ole db is supported in both the 1.0 and 1.1 version of the. NET Framework.
For ibm as/400 ole db Provider
' VB.NET
Imports System.Data.OleDb
...
Dim oOleDbConnection As OleDbConnection
Dim sConnString As String = _
"Provider=IBMDA400.DataSource.1;" & _
"Data source=myAS400DbName;" & _
"User Id=myUsername;" & _
"Password=myPassword"
oOleDbConnection = New OleDb.OleDbConnection(sConnString)
oOleDbConnection.Open()
For jet ole db Provider
' VB.NET
Imports System.Data.OleDb
...
Dim oOleDbConnection As OleDbConnection
Dim sConnString As String = _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:/myPath/myJet.mdb;" & _
"User ID=Admin;" & _
"Password="
oOleDbConnection = New OleDb.OleDbConnection(sConnString)
oOleDbConnection.Open()
For Oracle ole db Provider
' VB.NET
Imports System.Data.OleDb
...
Dim oOleDbConnection As OleDbConnection
Dim sConnString As String = _
"Provider=OraOLEDB.Oracle;" & _
"Data Source=MyOracleDB;" & _
"User ID=myUsername;" & _
"Password=myPassword"
oOleDbConnection = New OleDb.OleDbConnection(sConnString)
oOleDbConnection.Open()
For SQL Server OLE DB Provider
' VB.NET
Imports System.Data.OleDb
...
Dim oOleDbConnection As OleDbConnection
Dim sConnString As String = _
"Provider=sqloledb;" & _
"Data Source=myServerName;" & _
"Initial Catalog=myDatabaseName;" & _
"User Id=myUsername;" & _
"Password=myPassword"
oOleDbConnection = New OleDb.OleDbConnection(sConnString)
oOleDbConnection.Open()
ForSybase ase ole db Provider
' VB.NET
Imports System.Data.OleDb
...
Dim oOleDbConnection As OleDbConnection
Dim sConnString As String = _
"Provider=Sybase ASE OLE DB Provider;" & _
"Data Source=MyDataSourceName;" & _
"Server Name=MyServerName;" & _
"Database=MyDatabaseName;" & _
"User ID=myUsername;" & _
"Password=myPassword"
oOleDbConnection = New OleDb.OleDbConnection(sConnString)
oOleDbConnection.Open()
For more information, see: oledbconnection class and. NET data providers
To view Microsoft KB articles related to oledbconnection, click here
- Oracle. NET data provider-from Microsoft
System. Data. oracleclient
The Microsoft. NET Framework data provider for Oracle is an add-on
Component to the. NET Framework 1.0 that provides access to an oracle
Database using the Oracle call interface (OCI) as provided by Oracle
Client software.
Oracle 8i Release 3 (8.1.7) client or later must be installed for this provider to function correctly.
Note: This. NET data provider is supported in version 1.1 of the. NET Framework. You need only download this, if you are running version 1.0.
Using C #:
using System.Data.OracleClient;
OracleConnection oOracleConn = new OracleConnection();
oOracleConn.ConnectionString = "Data Source=Oracle8i;" +
"Integrated Security=SSPI";
oOracleConn.Open();
Using VB. NET:
Imports System.Data.OracleClient
Dim oOracleConn As OracleConnection = New OracleConnection()
oOracleConn.ConnectionString = "Data Source=Oracle8i;" & _
"Integrated Security=SSPI";
oOracleConn.Open()
For more information, see: oracleconnection class and. NET data providers
To view Microsoft KB articles related to oracleconnection, click here
- Oracle. NET data provider-from Oracle
Oracle. dataaccess. Client
The Oracle. NET Framework data provider from Oracle is an add-on component to the. NET Framework.
Using C #
using Oracle.DataAccess.Client;
...
OracleConnection oOracleConn = new OracleConnection();
oOracleConn.ConnectionString = "Data Source=MyOracleServerName;" +
"Integrated Security=SSPI";
oOracleConn.Open();
Using VB. NET
Imports Oracle.DataAccess.Client
...
Dim oOracleConn As OracleConnection = New OracleConnection()
oOracleConn.ConnectionString = "Data Source=MyOracleServerName;" & _
"Integrated Security=SSPI";
oOracleConn.Open()
For more information, see: Oracle data provider for. net
- Oradirect. NET data provider-from CoreLab
CoreLab. Oracle
The oradirect. NET data provider is an add-on component to the. NET
Framework that provides access to an Oracle database using the Oracle
Call interface (OCI) as provided by Oracle client software.
Using C #
using CoreLab.Oracle;
OracleConnection oOracleConn = new OracleConnection();
oOracleConn.ConnectionString = "User ID=myUsername;" +
"Password=myPassword;" +
"Host=(local);" +
"Pooling=true;" +
"Min Pool Size=0;" +
"Max Pool Size=100;" +
"Connection Lifetime=0";
oOracleConn.Open();
Using VB. NET
Imports CoreLab.Oracle
Dim oOracleConn As OracleConnection = New OracleConnection()
oOracleConn.ConnectionString = "User ID=myUsername;" & _
"Password=myPassword;" & _
"Host=(local);" & _
"Pooling=true;" & _
"Min Pool Size=0;" & _
"Max Pool Size=100;" & _
"Connection Lifetime=0"
oOracleConn.Open()
For more information, see: oradirect. NET data provider
- MySQL. NET data provider
Eid. mysqlclient
The MySQL. Net native provider is an add-on component to the. NET framework that allows you to access the MySQL database through
The native protocol, without going through ole db or ODBC.
Using C #
using EID.MySqlClient;
...
MySqlConnection oMySqlConn = new MySqlConnection();
oMySqlConn.ConnectionString = "Data Source=(local);" +
"Database=myDatabaseName;" +
"User ID=myUsername;" +
"Password=myPassword;" +
"Command Logging=false";
oMySqlConn.Open();
Using VB. NET
Imports EID.MySqlClient
...
Dim oMySqlConn As MySqlConnection = New MySqlConnection()
oMySqlConn.ConnectionString = "Data Source=(local);" & _
"Database=myDatabaseName;" & _
"User ID=myUsername;" & _
"Password=myPassword;" & _
"Command Logging=false"
oMySqlConn.Open()
For more information, see: Eid's MySQL ADO. Net native provider
- Postgresqldirect. NET data provider
CoreLab. PostgreSQL
The specified sqldirect. NET data provider is an add-on component to
. NET framework that allows you to access the PostgreSQL database using
Native message-based protocol, without going through ole db or ODBC.
Using C #
using CoreLab.PostgreSql;
PgSqlConnection oPgSqlConn = new PgSqlConnection();
oPgSqlConn.ConnectionString = "User ID=myUsername;" +
"Password=myPassword;" +
"Host=localhost;" +
"Port=5432;" +
"Database=myDatabaseName;" +
"Pooling=true;" +
"Min Pool Size=0;" +
"Max Pool Size=100;" +
"Connection Lifetime=0";
oPgSqlConn.Open();
Using VB. NET
Imports CoreLab.PostgreSql
Dim oPgSqlConn As PgSqlConnection = New PgSqlConnection()
oPgSqlConn.ConnectionString = "User ID=myUsername;" & _
"Password=myPassword;" & _
"Host=localhost;" & _
"Port=5432;" & _
"Database=myDatabaseName;" & _
"Pooling=true;" & _
"Min Pool Size=0;" & _
"Max Pool Size=100;" & _
"Connection Lifetime=0"
oPgSqlConn.Open()
For more information, see: postgresqldirect. NET data provider
- SQL Server. NET data provider
System. Data. sqlclient
The SQL Server. NET data provide allows you to connect to a Microsoft
SQL Server 7.0 or 2000 database. for Microsoft SQL Server 6.5 or
Earlier, use the ole db. NET data provider with the "SQL Server OLE DB provider" (sqloledb ).
Note: the SQL server. NET data provider knows which data provider it
Is. Hence the "provider =" part of the connection string is not needed.
Using C #:
using System.Data.SqlClient;
...
SqlConnection oSQLConn = new SqlConnection();
oSQLConn.ConnectionString = "Data Source=(local);" +
"Initial Catalog=myDatabaseName;" +
"Integrated Security=SSPI";
oSQLConn.Open();
Using VB. NET:
Imports System.Data.SqlClient
...
Dim oSQLConn As SqlConnection = New SqlConnection()
oSQLConn.ConnectionString = "Data Source=(local);" & _
"Initial Catalog=myDatabaseName;" & _
"Integrated Security=SSPI"
oSQLConn.Open()
If connection to a remote server (via IP address ):
oSQLConn.ConnectionString = "Network Library=DBMSSOCN;" & _
"Data Source=xxx.xxx.xxx.xxx,1433;" & _
"Initial Catalog=myDatabaseName;" & _
"User ID=myUsername;" & _
"Pas sword=myPassword"
Where:
-"Network library = dbmssocn" tells sqlconnection to use TCP/IP q238949
-XXX. XXX is an IP address.
-1433 is the default port number for SQL Server. q269882 and q287932
-You can also add "encrypt = yes" for encryption
For more information, see: sqlconnection class, q308656, And. NET data providers
Note: Microsoft SQLXML managed classes exposes the functionality of SQLXML inside the Microsoft. NET Framework.
To view Microsoft KB articles related to sqlclient, click here