asp.net关闭窗体时执行的代码写在哪里???
我有一个框架集对应3个窗体
在调试时,关闭框架集窗体时需要修改数据库里的信息,
请问我需要把:修改数据库信息的代码写在哪里????
写在Global.asax下
protected void Session_End(Object sender, EventArgs e)
{
SqlConnection con=new SqlConnection(@"workstation id=7F595D0BD5C9464;packet size=4096;user id=sa;pwd=sa;data source=7F595D0BD5C9464;persist security info=False;initial catalog=Chat");
con.Open();
SqlCommand com=new SqlCommand("update ChatTable set ZaiXian='0' where Name='"+Session["UserName"].ToString()+"'",con);
com.ExecuteNonQuery();
con.Close();
}里和
protected void Application_End(Object sender, EventArgs e)里
都没有效果,数据库并没有别修改
请高手帮忙谢谢