PutCollect() 参数错误怎么改

zx_freshman 2014-11-05 04:32:44
CString name, num, tel, addr, born, school,sex;
mAddress.GetWindowText(addr);
mcombo.GetWindowText(school);
mName.GetWindowText(name);
mTel.GetWindowText(tel);
mSex.GetWindowText(sex);
mNum.GetWindowText(num);
GetDlgItem(IDC_RADIO1+mv)->GetWindowText(born);


try{
m_pRecordset->AddNew();
m_pRecordset->MoveFirst();
m_pRecordset->PutCollect((("cAccNo")), _bstr_t(cacc));
m_pRecordset->PutCollect((("cName")), _bstr_t(name));
m_pRecordset->PutCollect((("cTel")), _bstr_t(tel));
m_pRecordset->PutCollect((("cAddr")), _bstr_t(addr));
m_pRecordset->PutCollect((("cID")), _bstr_t(num));
m_pRecordset->PutCollect((("cSex")), _bstr_t(sex));
m_pRecordset->PutCollect((("cBorn")), _bstr_t(born));
m_pRecordset->PutCollect((("cIDType")), _bstr_t(school));
m_pRecordset->Update();
m_pRecordset->Close();

a.ExitConnection();
}
catch (_com_error e){
MessageBox(e.Description());
}
...全文
90 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
zx_freshman 2014-11-05
  • 打赏
  • 举报
回复
太感谢了!
zyq5945 2014-11-05
  • 打赏
  • 举报
回复
不能都转成_bstr_t字符串来处理,需要和数据库字段对应起来,可以看下这个.
zx_freshman 2014-11-05
  • 打赏
  • 举报
回复
总是说类型不匹配不知道怎么改

4,011

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 数据库
社区管理员
  • 数据库
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧