实际上我的数据库连接看起来像这样......,现在我想介绍连接池。我可以知道如何写这个...,
public static string dbpath()
{
try
{
string strcon = @"Data Source=local\SQLEXPRESS;Initial Catalog=aniv;Integrated Security=True";
SqlConnection con = new SqlConnection(strcon);
if (con.State == ConnectionState.Open)
{
con.Close();
}
con.Open();
return strcon;
}
catch (SqlException ex)
{
MessageBox.Show(ex.Message);
return "0";
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
return "0";
}
}