MFC ODBC access 数据库连接 大虾们帮帮忙
编译连接时出现 无效的描述器索引CModifyDlg AddDlg;
AddDlg.m_nType =0;
if(AddDlg.DoModal()!=IDOK)
return ;
CStudentInfoSet* pStudentSet = new CStudentInfoSet(&theApp.GetDatebase());
if(!pStudentSet)
return ;
CString strSQL;
strSQL.Format("select *from StudentInfo where StudentID = %d",AddDlg.m_nID);
pStudentSet->Open(AFX_DB_USE_DEFAULT_TYPE,strSQL);
if(pStudentSet->GetRecordCount() !=0)
{
AfxMessageBox(_T("学号不能重复"));
return ;
}
strSQL.Format("insert into StudentInfo values(\'%d\', \'%s \', \'%d\', \'%d \', \'%d\')",
AddDlg.m_nID, AddDlg.m_strName, AddDlg.m_nEnglish, AddDlg.m_nMath, AddDlg.m_nChinese);
theApp.GetDatebase().ExecuteSQL(strSQL);
ShowInfo();
delete pStudentSet;