((CEx11_2App*)AfxGetApp())->m_pADOConn),
true),adOpenDynamic,adLockPessimistic,adCmdText);
if(SUCCEEDED(hTRes))
{
TRACE(_T("连接成功!\n"));
if(theApp.m_pADOSet->BOF)
{
return;
}
if(theApp.m_pADOSet->MoveFirst()==S_OK)
{
m_strStuID=theApp.VariantToCString(theApp.m_pADOSet->GetCollect("StuID"));
m_strStuName=theApp.VariantToCString(theApp.m_pADOSet->GetCollect("StuName"));
m_strStuNativePlace=theApp.VariantToCString(theApp.m_pADOSet->GetCollect("StuNativePlace"));
m_strStuClass=theApp.VariantToCString(theApp.m_pADOSet->GetCollect("StuClass"));
m_strStuCollege=theApp.VariantToCString(theApp.m_pADOSet->GetCollect("StuCollege"));
UpdateData(false);
}
}
}
}
catch(_com_error e)///捕捉异常
{
CString errormessage;
MessageBox("ShowTable创建db记录集失败1!+strSQL");
}
//m_pRecordset->Close();
}
void CEx11_2View::OnRecordFirst() //首记录
{
// TODO: Add your command handler code here
theApp.m_pADOSet->MoveFirst();
try
{
m_strStuID=theApp.VariantToCString(theApp.m_pADOSet->GetCollect("StuID"));
m_strStuName=theApp.VariantToCString(theApp.m_pADOSet->GetCollect("StuName"));
m_strStuNativePlace=theApp.VariantToCString(theApp.m_pADOSet->GetCollect("StuNativePlace"));
m_strStuClass=theApp.VariantToCString(theApp.m_pADOSet->GetCollect("StuClass"));
m_strStuCollege=theApp.VariantToCString(theApp.m_pADOSet->GetCollect("StuCollege"));
UpdateData(false);
}
catch(_com_error*e)
{
AfxMessageBox(e->ErrorMessage());
}
}
void CEx11_2View::OnRecordPrev() //前一记录
{
// TODO: Add your command handler code here
theApp.m_pADOSet->MovePrevious();
if(theApp.m_pADOSet->BOF)
{
AfxMessageBox("已经是首记录!");
theApp.m_pADOSet->MoveLast();
}
try
{
m_strStuID=theApp.VariantToCString(theApp.m_pADOSet->GetCollect("StuID"));
m_strStuName=theApp.VariantToCString(theApp.m_pADOSet->GetCollect("StuName"));
m_strStuNativePlace=theApp.VariantToCString(theApp.m_pADOSet->GetCollect("StuNativePlace"));
m_strStuClass=theApp.VariantToCString(theApp.m_pADOSet->GetCollect("StuClass"));
m_strStuCollege=theApp.VariantToCString(theApp.m_pADOSet->GetCollect("StuCollege"));
UpdateData(false);
}
catch(_com_error*e)
{
AfxMessageBox(e->ErrorMessage());
}
}
void CEx11_2View::OnRecordNext() //下一记录
{
// TODO: Add your command handler code here
theApp.m_pADOSet->MoveNext();
if(theApp.m_pADOSet->adoEOF)
{
AfxMessageBox("已经是末记录!");
theApp.m_pADOSet->MoveLast();
}
try
{
m_strStuID=theApp.VariantToCString(theApp.m_pADOSet->GetCollect("StuID"));
m_strStuName=theApp.VariantToCString(theApp.m_pADOSet->GetCollect("StuName"));
m_strStuNativePlace=theApp.VariantToCString(theApp.m_pADOSet->GetCollect("StuNativePlace"));
m_strStuClass=theApp.VariantToCString(theApp.m_pADOSet->GetCollect("StuClass"));
m_strStuCollege=theApp.VariantToCString(theApp.m_pADOSet->GetCollect("StuCollege"));
UpdateData(false);
}
catch(_com_error*e)
{
AfxMessageBox(e->ErrorMessage());
}
}
void CEx11_2View::OnRecordLast() //末记录
{
// TODO: Add your command handler code here
theApp.m_pADOSet->MoveLast();
try
{
m_strStuID=theApp.VariantToCString(theApp.m_pADOSet->GetCollect("StuID"));
m_strStuName=theApp.VariantToCString(theApp.m_pADOSet->GetCollect("StuName"));
m_strStuNativePlace=theApp.VariantToCString(theApp.m_pADOSet->GetCollect("StuNativePlace"));
m_strStuClass=theApp.VariantToCString(theApp.m_pADOSet->GetCollect("StuClass"));
m_strStuCollege=theApp.VariantToCString(theApp.m_pADOSet->GetCollect("StuCollege"));
UpdateData(false);
UpdateData(false);
}
catch(_com_error*e)
{
AfxMessageBox(e->ErrorMessage());
}
}