1. sqlconnection
Syntax: Public sealed class sqlconnection: dbconnection, icloneable
Indicates the connection to the SQL Server database. This class cannot be inherited.
Namespace: system. Data. sqlclientAssembly: system. Data (in system. Data.
1 God said, to connect to the database, so there is a SqlConnection (database connection, configuration connection string, such as user name password)2 God says, to execute the SQL statement. Then there is the SqlCommand, directly translated into
Sqlconnection, sqldataadapter, sqlcommand, and sqlparameter are often used in the charging system of the VB.net data center. These classes are both sqlclient classes and sqlclient classes are located in system. in the data namespace, this namespace
The problem encountered over the past few days is that sqlconnection. when the database is disconnected (such as stopping SQL Service), open returns normally without errors. After research, it is found that ado.net adopts the connection pool
the development process of a database application is generally divided into the following steps:
Create a database
To connect to a database using a Connection object
Execute SQL commands against the data source using the Command
In the previous article, I briefly discussed the correct use of sqlconnection. by talking about the connection pool, I accidentally encountered a problem: After the close and dispose methods of sqlconnection are executed, is this connection object
1. to connect to a database using connection:(1). Add namespace System.Data.SqlClient (Note: Beginners often forget)(2) Define the connection string. When connecting to a SQL Server database:server= server name; database= database name; uid=
OleDbConnection is suitable for connecting any type of database (such as Oracle,sql server,access, etc.) with the namespace: using System.Data.OleDb;. Instead, SqlConnection is designed to connect to a SQL Server (MS SQL) database with the namespace:
Composition of. NET data providers
. NET data providers have two types of functions: Non-connection data support and connection data support.
The following table lists the main components of the. NET data provider:
The component implementation in
There are four connection types: sqlconnection, oledbconnection, odbcconnection, and oracleconnection.
Objects in the sqlconnection class are connected to the SQL Server database; objects in the oracleconnection class are connected to the Oracle
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.