您好我用这个查询更新我的数据库,但不工作:为什么我的查询无法正常工作?
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;*/
}
}
define define not working,it it error? –
@Luke McGregor它没有任何错误。 –
这是我的建议:提供有关该问题的更多信息。或者,也许在发布之前收集更多信息。 – keyser