ado| Data | database | database connection
In MSDN, the. NET database connection strings are described in detail, and I'll list them here in code example, and the meaning of each representative can be reviewed in MSDN.
Database connection mode in Ado.net (provided by Microsoft)
Microsoft offers the following four ways to connect to a database:
System.Data.OleDb.OleDbConnection
System.Data.SqlClient.SqlConnection
System.Data.Odbc.OdbcConnection
System.Data.OracleClient.OracleConnection
Here's an example of how to:
System.Data.SqlClient.SqlConnection
Some common connection strings (C # code):
SqlConnection Conn
= New SqlConnection ("server= (local); integrated security=sspi;database=pubs");
SqlConnection Conn
= New SqlConnection ("server= (local) \\netsdk;database=pubs;integrated Security=sspi");
SqlConnection conn = new SqlConnection (
"Data source=localhost;integrated security=sspi;initial catalog=northwind;");
More string connection instructions see MSDN:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/ Frlrfsystemdatasqlclientsqlconnectionclassconnectionstringtopic.asp
System.Data.OleDb.OleDbConnection
Some common connection strings (C # code):
OleDbConnection conn = new OleDbConnection (@ "Provider=Microsoft.Jet.OLEDB.4.0;Data source=d:\myweb\81\05\ Grocertogo.mdb ");
OleDbConnection conn = new OleDbConnection (
@ "Provider=Microsoft.Jet.OLEDB.4.0; password=;
User id=admin;data source=grocertogo.mdb; ");
OleDbConnection conn = new OleDbConnection (
"Provider=msdaora; Data Source=oracle8i7; Persist security info=false;integrated Security=yes ");
OleDbConnection conn = new OleDbConnection (
"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\bin\localaccess40.mdb ");
OleDbConnection conn = new OleDbConnection (
"Provider=sqloledb;data source=mysqlserver;integrated Security=sspi");
More string connection instructions see MSDN:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/ Frlrfsystemdataoledboledbconnectionclassconnectionstringtopic.asp?frame=true
System.Data.OracleClient.OracleConnection
Some common connection strings (C # code):
OracleConnection myconn = new System.Data.OracleClient.OracleConnection (
"Data source=oracle8i;integrated security=yes");
More string connection instructions see MSDN:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/ Frlrfsystemdataoracleclientoracleconnectionclassconnectionstringtopic.asp?frame=true
System.Data.Odbc.OdbcConnection
Some common connection strings (C # code):
OdbcConnection conn = new OdbcConnection (
"Driver={microsoft Text Driver (*.txt; *.csv)};D bq=c:\bin ");
OdbcConnection conn = new OdbcConnection ("Dsn=dsnname");
More string connection instructions see MSDN:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/ Frlrfsystemdataodbcodbcconnectionclassconnectionstringtopic.asp?frame=true
Implicit connection pool connection support is provided in the data provider in SQL Server, OLE DB, and the. NET Framework structure. You can specify different parameter values in the ConnectionString to control the behavior of the connection pool. For example, the following example causes the connection pool of OLE DB to be invalid and automatically transacted:
Provider=sqloledb;ole DB services=-4;data source=localhost;integrated Security=sspi;
The following parameter settings are provided in SQL Server.NET Data provider to control the behavior of the connection pool: Connection lifttime, Connection Reset, Enlist, Max pool Size, Min pool Size and pooling.
More database connection information, as well as a ado.net connection string, can be used to refer to:
http://www.connectionstrings.com/
--Reprint
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.