if (con == null)
{
con = new SqlConnection(JW_conn);
}
if (con.State == ConnectionState.Closed)
{
try
{
///打开数据库连接
con.Open();
}
catch (Exception ex)
{
HttpContext.Current.Response.Write(ex.Message);
}
}
}
/// <summary>
/// 关闭数据库连接
/// </summary>
public void Close()
{
///判断连接是否已经创建
if (con != null)
{
///判断连接的状态是否打开
if (con.State == ConnectionState.Open)
{
con.Close();///这句出现异常信息,到底是怎么回事
}
}
------解决方案--------------------------------------------------------
post the error