首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VC/MFC >

代码报了一个error C2678: binary异常哪位达人帮助下呢

2012-02-27 
代码报了一个error C2678: binary错误哪位达人帮助下呢?_variant_t RecordsAffected_bstr_t InsertCStri

代码报了一个error C2678: binary错误哪位达人帮助下呢?
_variant_t RecordsAffected;
_bstr_t Insert;
  
CString id;
CString name;
CString password;
  
GetDlgItem(IDC_EDIT1)->GetWindowText(id);  
GetDlgItem(IDC_EDIT2)->GetWindowText(name);  
GetDlgItem(IDC_EDIT3)->GetWindowText(password);  

Insert = "Insert into best(id, name, password) values('" + id + "','" + name + "', '" + password + "' ) ";
pRst =pConn->Execute(Insert, &RecordsAffected, adCmdText);
AfxMessageBox(_T("添加成功!"));


以上代码在insert这里报了个错,谁能帮我看看呢,谢谢了
e:\vc\test\test0207\test0207\test0207dlg.cpp(181) : error C2678: binary '+' : no operator found which takes a left-hand operand of type 'const char [46]' (or there is no acceptable conversion)
  e:\program files\microsoft visual studio 8\vc\atlmfc\include\atlsimpstr.h(666): could be 'ATL::CSimpleStringT<BaseType,t_bMFCDLL> ATL::CSimpleStringT<BaseType,t_bMFCDLL>::operator +(const ATL::CSimpleStringT<BaseType,t_bMFCDLL> &,const ATL::CSimpleStringT<BaseType,t_bMFCDLL> &)' [found using argument-dependent lookup]
 

[解决办法]
Insert = CString("Insert into best(id, name, password) values('") + id + "','" + name + "', '" + password + "' ) ";

热点排行