我正在尝试编辑我的sql数据库中以前保存的项目,但是当我应用此代码时,它可以正常工作,但对我的数据库没有任何影响。
protected void Page_Load(object sender,EventArgs e)
{
userid = Convert.ToInt16(Session["UserID"]);
User_Account x = query();
tb_Email.Text = x.E_Mail_Address;
tb_fName.Text = x.First_Name;
tb_lName.Text = x.Last_Name;
tb_password.Text = x.Password;
}
protected void b_save_Click(object sender, EventArgs e)
{
User_Account x = query();
x.E_Mail_Address = tb_Email.Text;
x.First_Name = tb_fName.Text;
x.Last_Name = tb_lName.Text;
x.Password = tb_password.Text;
ctx.SubmitChanges();
Response.Write("<script type=\"text/javascript\">alert('Update Successful');</script>");
Response.Redirect("~/User Page/UserPage.aspx");
}