源码:
string strConn="server=localhost;user id=***;password=***;database=test;Min Pool Size=10;Max Pool Size=5000";
SqlConnection mConnection1=new SqlConnection(strConn);
mConnection1.Open();
try
{
SqlDataAdapter MyAdapter1 = new SqlDataAdapter();
MyAdapter1.InsertCommand = new SqlCommand("Insert_Report2", mConnection1);
MyAdapter1.InsertCommand.CommandType = CommandType.StoredProcedure;
MyAdapter1.InsertCommand.Parameters.Clear();
MyAdapter1.InsertCommand.Parameters.Add("@spPrice1", SqlDbType.NVarChar , 10, "SPrice1");
MyAdapter1.InsertCommand.Parameters.Add("@spPrice2", SqlDbType.NVarChar , 10, "SPrice2");
MyAdapter1.Update (ds_type,ds_type.Tables[0].TableName);
}
catch(SqlException err)
{
string test2=err.Message .ToString ();
}
mConnection1.Close ();
mConnection1.Dispose ();
要不就是抛出"从池中获取连接 超时",要不就是运行到一定时间就僵在那里不动了,该关闭的也关闭了,maxpool也设置了,到底是怎么回事呢
string strConn="server=localhost;user id=***;password=***;database=test;Min Pool Size=10;Max Pool Size=5000";
SqlConnection mConnection1=new SqlConnection(strConn);
mConnection1.Open();
try
{
SqlDataAdapter MyAdapter1 = new SqlDataAdapter();
MyAdapter1.InsertCommand = new SqlCommand("Insert_Report2", mConnection1);
MyAdapter1.InsertCommand.CommandType = CommandType.StoredProcedure;
MyAdapter1.InsertCommand.Parameters.Clear();
MyAdapter1.InsertCommand.Parameters.Add("@spPrice1", SqlDbType.NVarChar , 10, "SPrice1");
MyAdapter1.InsertCommand.Parameters.Add("@spPrice2", SqlDbType.NVarChar , 10, "SPrice2");
MyAdapter1.Update (ds_type,ds_type.Tables[0].TableName);
}
catch(SqlException err)
{
string test2=err.Message .ToString ();
}
mConnection1.Close ();
mConnection1.Dispose ();
要不就是抛出"从池中获取连接 超时",要不就是运行到一定时间就僵在那里不动了,该关闭的也关闭了,maxpool也设置了,到底是怎么回事呢
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货