CString strSQL;
int nID=0;
CString strName="張三"; //此處用中文會有問題,換成字母或數字就沒有問題
strSQL.Format("INSERT INTO MYTABLE(id,name) VALUES(%d,'%s')",nID,strName);
_bstr_t bstrSQL=strSQL.AllocSysString();
m_pConnection->Execute(bstrSQL,...);
CString strSQL;
int nID=0;
CString strName=_T("張三");
strSQL.Format("INSERT INTO MYTABLE(id,name) VALUES(%d,'%s')",nID,strName);
_bstr_t bstrSQL=strSQL.AllocSysString();
m_pConnection->Execute(bstrSQL,...);
CString strSQL;
int nID=0;
CString strName="張三"; //此處用中文會有問題,換成字母或數字就沒有問題
strSQL.Format("INSERT INTO MYTABLE(id,name) VALUES(%d,'%s')",nID,strName);
try
{
_bstr_t bstrSQL=strSQL.AllocSysString();
m_pConnection->Execute(bstrSQL,...);
}catch(_com_error e)
{
MessageBox(e.Description, e.ErrorMessage);
}
本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系我们删除。