嗨,我使用此查询更新我的数据库,但无法正常工作:
if (Request["mode"] != null)
{
Int32 ID = Int32.Parse(Request["Id"].ToString());
using (NoavaranModel.NoavaranEntities1 dbContext = new NoavaranModel.NoavaranEntities1())
{
var ToEdit = (from n in dbContext.Packages
where n.Id == ID
select n).FirstOrDefault();
ToEdit.Name = txtName.Text;
ToEdit.Level = txtLevel.Text;
ToEdit.Description = txtDescription.Text;
ToEdit.ForAge = ddlAgeFor.SelectedItem.Text;
ToEdit.CatId = ddlCategory.SelectedIndex + 1;
dbContext.SaveChanges();
//Response.Redirect("Packages.aspx");
//return;*/
}
}