Author: eaglet
Reprinted please indicate the source
. When using sqlconnection to connect to SQL Server, we will find that the first connection is always time-consuming, but the later connection is very fast. This is actually related to the
Correct understanding of this connection pool mechanism helps us to write efficient database applications.
Many people think that the SqlConnection connection is not time-consuming, because SqlConnection is executed cyclically. the average Open time
Provide a detailed description of the sqlconnection pool. If you need it, please refer to it.
Provide a detailed description of the sqlconnection pool. If you need it, please refer to it.
When a physical connection is established, You need to
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
I have seen someone write code like this before:
Copy codeThe Code is as follows: public class Service1: IService1
{
Private SqlConnection conn = new SqlConnection ();
Public void Method1 ()
{
// Do something with conn;
}
Public void Method2 ()
{
//
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.
When a physical connection is established, you need to shake hands with the server, parse the connection string, authorize, and check constraints. After the physical connection is established, these operations will not be performed. These operations
A proper understanding of this connection pooling mechanism helps us to write efficient database applications.
Many people think that the SqlConnection connection is not time-consuming, the reason is that the average time of the loop execution
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 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.