How Come this is not allowed?
public void addInsertedInformationToDb() {
using(DbClassesDataContext myDb = new DbClassesDataContext(dbPath)){
myDb.PatientInfos.InsertOnSubmit(insertPersonalInformation);
}
}
Where my insertPersonalInformation
private PatientInfo insertPersonalInformation()
{
DbClassesDataContext myDb = new DbClassesDataContext(dbPath);
PatientInfo patientInfo = new PatientInfo();
patientInfo.Phy_ID = physcianID;
patientInfo.Pat_First_Name = txtFirstName.Text;
patientInfo.Pat_Middle_Name = txtMiddleName.Text;
patientInfo.Pat_Last_Name = txtLastName.Text;
patientInfo.Pat_Gender = cmbGender.Text;
patientInfo.Pat_Marital_Status = cmbMaritalStatus.Text;
patientInfo.Pat_Date_Of_Birth = dtpDOB.Value;
patientInfo.Pat_Home_Add = txtHomeAdd.Text;
patientInfo.Pat_Home_Num = txtPhone.Text;
patientInfo.Pat_Work_Add = txtWorkAdd.Text;
patientInfo.Pat_Work_Num = txtWorkPhone.Text;
patientInfo.Pat_Prim_Physician = txtPrimPhysician.Text;
patientInfo.Pat_Ref_Physician = txtRefePhysician.Text;
return patientInfo;
}
I kept on getting these errors
Error 1 The best overloaded method match for 'System.Data.Linq.Table.InsertOnSubmit(PatientAdministration.PatientInfo)' has some invalid arguments C:\Users\John\documents\visual studio 2010\Projects\PatientAdministration\PatientAdministration\Pat_Demog.cs 101 17 PatientAdministration
Error 2 Argument 1: cannot convert from 'method group' to 'PatientAdministration.PatientInfo' C:\Users\John\documents\visual studio 2010\Projects\PatientAdministration\PatientAdministration\Pat_Demog.cs 101 50 PatientAdministration
What is the fix for this?