The name patientid does not exist in the current context
Hi I get this error message "the name patientid does not exist in the current context" and also, "the name formpatientid does not exist in the current context". Why would this be occuring?
public void patientUpdate()
{
hospitalSQLEntities db = new hospitalSQLEntities();
string formpatiendid = Request.Para开发者_Python百科ms["patientid"];
patient mypatient = null;
try
{
mypatient = db.patients.Single(u => **patientid.Equals(formpatientid))**;
}
Does this fix the issue?
public void patientUpdate()
{
hospitalSQLEntities db = new hospitalSQLEntities();
string formpatientid = Request.Params["patientid"];
patient mypatient = null;
try
{
mypatient = db.patients.Single(u =>
u.patientid.Equals(formpatientid));
}
I also not use the try
block. It's bad practice to just trap everything.
精彩评论