如何解决这个问题;连接已经在我的函数中关闭:
SqlConnection con=new SqlConnection(@"Here is My Connection");
public void run_runcommand(string query)
{
try
{
con.Open();
SqlCommand cmd1 = new SqlCommand(query, con);
cmd1.ExecuteNonQuery();
con.Close();
}
catch (Exception ex) { throw ex; }
}
//...
try
{
string query="my query";
db.run_runcommand(query);
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}