复制代码 代码如下:
"The sp_reset_connection stored procedure is used by SQL
Server to support remote stored procedure calls in a transaction. This stored
procedure also causes Audit Login and Audit Logout events to fire when a
connection is reused from a connection pool."
复制代码 代码如下:
String ConnectionString = "data source=.//sql2012;database=AdventureWorks;uid=sa;pwd=sasasa";
SqlConnection cn1=new SqlConnection(ConnectionString);
SqlCommand cmd1=cn1.CreateCommand();
cmd1.CommandText="SELECT * FROM dbo.ABCD";
cn1.Open();
cmd1.ExecuteReader();
cn1.Close();
Response.Write("连接关闭时间:"+DateTime.Now.ToLongTimeString()+"<br />");
System.Threading.Thread.Sleep(10000);
SqlConnection cn2=new SqlConnection(ConnectionString);
SqlCommand cmd2=cn2.CreateCommand();
cmd2.CommandText="SELECT * FROM dbo.ABCD";
cn2.Open();
cmd2.ExecuteReader();
cn2.Close();
Response.Write("连接关闭时间:"+DateTime.Now.ToLongTimeString()+"<br />");
SqlConnection cn3=new SqlConnection(ConnectionString);
SqlCommand cmd3=cn3.CreateCommand();
cmd3.CommandText="SELECT * FROM dbo.ABCD";
cn3.Open();
cmd3.ExecuteReader();
cn3.Close();
Response.Write("连接关闭时间:"+DateTime.Now.ToLongTimeString()+"<br />");
System.Threading.Thread.Sleep(1500);
SqlConnection cn4=new SqlConnection(ConnectionString);
SqlCommand cmd4=cn4.CreateCommand();
cmd4.CommandText="SELECT * FROM dbo.ABCD";
cn4.Open();
cmd4.ExecuteReader();
cn4.Close();
Response.Write("连接关闭时间:"+DateTime.Now.ToLongTimeString()+"<br />");
新闻热点
疑难解答