public void SchemeUpdate(int SchemeID, int InsurerID, string Name, string Description)
{
Health_Scheme_System.Scheme updscheme = Scheme.Find(x => x.SchemeID == SchemeID).FirstOrDefault();
//updscheme.SchemeID = SchemeID;
//updscheme.InsurerID = InsurerID;
updscheme.Name = Name;
updscheme.Description = Description;
updscheme.Save();
}
Calling the method
//Converting to integer and date
int SchemeID;
int.TryParse(txtSchemeID.Text, out SchemeID);
int insurerID;
int.TryParse(txtInsurerID.Text, out insurerID);
//Getting the parameters from the method
DataAccess updscheme = new DataAccess();
//DataAccess updrates = new DataAccess();
updscheme.SchemeUpdate(SchemeID, insurerID, txtName.Text, txtDescription.Text);
//updrates.RatesUpdate(SchemeID, txtRates.Text);
//Binding the gridView to display the updates
txtSchemeID.Visible = false;
txtInsurerID.Visible = false;
gvSchemeMain.DataSource = ds.GetRates();
gvSchemeMain.DataBind();
我认为问题在于参数..
答案 0 :(得分:1)
根据您的评论,它看起来像这一行:
Health_Scheme_System.Scheme updscheme = Scheme.Find(x => x.SchemeID == SchemeID).FirstOrDefault();
没有返回任何东西。换句话说,没有任何具有你正在使用的ID的方案。
您可以手动在数据库中检查Scheme
并获取其ID值。然后,您可以通过将该值传递给SchemeID参数来测试上述代码。