This is a normal program. This program is placed on a page. No matter how many users or users simultaneously request this page, you can view it through sp_who after the request processing is complete, or that one. You know why it's called a normal program. It's in line with normal reasoning.
Using (sqldatareader reader = maticsoft.dbutility.dbhelpersql.exe cutereader ("select top 1 * from protuct order by id desc "))
{
While (reader. read ())
{
Response. write (reader ["name"]. tostring ());
}
}
Using (sqldatareader reader2 = maticsoft.dbutility.dbhelpersql.exe cutereader ("select top 1 * from users order by userid desc "))
{
While (reader2.read ())
{
Response. write (reader2 ["username"]. tostring ());
}
}
Let's take a look at the data connection code that some of our friends often use.
Data source = .; initial catalog = test; persist security info = true; user id = testuser; password = 123456; min pool size = 10; max pool size = 150; connection lifetime = 10
Min pool size = 10; max pool size = 150; connection lifetime = 10
The connection pool of the database tutorial is enabled by default. The above attribute is used to configure the connection pool. This means that when you send a database Request to your page, you do not have to create a database connection, but it may be from an existing connection pool, activate a connection to process your request. Similarly, when you call close in your code to explicitly close the database connection, it is not necessarily that the database connection is actually closed, if the current connection pool does not meet the min pool size requirement, it only returns to the connection pool and waits for the next command to activate it.
Sp_who 'testusers' // testusers is the user name you specified when establishing the connection
Check the number of connections.