【发布时间】:2012-03-04 11:43:29
【问题描述】:
为什么这是不允许的?
public void addInsertedInformationToDb() {
using(DbClassesDataContext myDb = new DbClassesDataContext(dbPath)){
myDb.PatientInfos.InsertOnSubmit(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;
}
我不断收到这些错误
错误 1 'System.Data.Linq.Table.InsertOnSubmit(PatientAdministration.PatientInfo)' 的最佳重载方法匹配有一些无效参数 C:\Users\John\documents\visual studio 2010\Projects\PatientAdministration\PatientAdministration\ Pat_Demog.cs 101 17 患者管理
错误 2 参数 1:无法从“方法组”转换为“PatientAdministration.PatientInfo”C:\Users\John\documents\visual studio 2010\Projects\PatientAdministration\PatientAdministration\Pat_Demog.cs 101 50 PatientAdministration
有什么办法解决这个问题?
【问题讨论】:
标签: c# .net linq linq-to-sql