超时时间已到
网站在服务器上运行,出现了“超时时间已到,但尚未从池中获取连接,出现这种情况可能是因为所有池均在使用,并且达到了最大池大小。,怎么解决啊。namespace Management.DAL
{
public static class DBHelper
{
private static SqlConnection connection;
public static SqlConnection Connection
{
get
{
string connectionString = "Data Source=.;Initial Catalog=kq;Integrated Security=True"; //ConfigurationManager.ConnectionStrings["MyOfficeConnectionString"].ConnectionString;
connection = new SqlConnection(connectionString);
if (connection == null)
{
connection.Open();
}
else if (connection.State == System.Data.ConnectionState.Closed)
{
connection.Open();
}
else if (connection.State == System.Data.ConnectionState.Broken)
{
connection.Close();
connection.Open();
}
return connection;
}
}
应该怎么修改啊。