连接未关闭。 连接的当前状态为打开。问题的解决
public static SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
if (conn.State ==ConnectionState.Closed)
{
conn.Open();
}
一定要在打开前判断.
或者查看open语句外部是否已经包裹了open的语句如:
public ***** ()
{
SqlConnection conn = new SqlConnection(*********);
conn.open()
using(***********)
{
****
****
****
****
conn.open();
ExecuteNonQuery();
conn.close();
}
conn.close
}