日期:2014-05-17 浏览次数:20438 次
private static SqlConnection sc;
public static SqlConnection Sc
{
get
{
string StrConWeb = ConfigurationManager.ConnectionStrings["YunNiao"].ConnectionString;
try
{
if (sc == null)
{
sc = new SqlConnection(StrConWeb);
sc.Open();
}
else if (sc.State == ConnectionState.Closed)
{
sc.Open();
}
else if (sc.State == ConnectionState.Broken)
{
sc.Close();
sc.Open();
}
return sc;
}
catch (Exception e)
{
throw new Exception(e.Message);
}
}
}
&n