UPdate()错了,却不知道怎么修改
void Bookinfmation::OnBnClickedButton1(){
// TODO: 在此添加控件通知处理程序代码
_RecordsetPtr m_pRecordset;
m_pRecordset.CreateInstance(__uuidof(Recordset));
MYsql mysql;
_bstr_t sql = "SELECT * FROM 书籍信息";
m_pRecordset = mysql.GetRecordSet(sql);
CString a1,a2,a3,a4,a5,a6;
GetDlgItem(B_BookName)->GetWindowText(a1);
GetDlgItem(B_BookID)->GetWindowText(a2);
GetDlgItem(B_Form)->GetWindowText(a3);
GetDlgItem(B_Publisher)->GetWindowText(a4);
GetDlgItem(B_Price)->GetWindowText(a5);
GetDlgItem(B_Publish_date)->GetWindowText(a6);
//try
//{
if (m_pRecordset != NULL)//&&m_pRecordset->adoEOF)
{
m_pRecordset->MoveLast();
m_pRecordset->AddNew();
//UpdateData();
//AfxMessageBox(_T("增加新的一行"));
m_pRecordset->PutCollect("BookName", (_bstr_t)a1);
m_pRecordset->PutCollect("BookID", (_bstr_t)a2);
m_pRecordset->PutCollect("Form", (_bstr_t)a3);
m_pRecordset->PutCollect("Publisher", (_bstr_t)a4);
m_pRecordset->PutCollect("Price", (_bstr_t)a5);
m_pRecordset->PutCollect("Publish_date", (_bstr_t)a6);
m_pRecordset->Update(); //???错了
AfxMessageBox(_T("增加成功"));
}
//}
else //catch (_com_error e)
{
AfxMessageBox(_T("添加失败"));
}
}
哪位大大告诉我为什么Update()错了