📄 subject_18468.htm
字号:
<p>
序号:18468 发表者:sdf 发表日期:2002-10-21 11:25:25
<br>主题:一个ADO访问数据库的问题
<br>内容:遇见一问题,在执行SQL语句时,好象有问题,不只为什么,是不是VC++中不能这样直接带参数啊?那应该怎么带参数 ?<BR>m_pCmd->CommandText="INSERT INTO SYSTEMPARAMETER (DbPath,logPath,ParaSetPassword,ExitPassword) VALUES ('"+m_strDbPath+"','"+m_strLogPath+"','"+m_strParaSetPassword+"','"+m_strExitPassword+"') ";<BR>m_pCmd->Execute(NULL,NULL,NULL);<BR>错误是:<BR> error C2664: 'PutCommandText' : cannot convert parameter 1 from 'class CString' to 'class _bstr_t'<BR> No constructor could take the source type, or constructor overload resolution was ambiguous
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:静风 回复日期:2002-10-22 15:27:42
<br>内容:强制转化一下<BR>CString sql="INSERT INTO SYSTEMPARAMETER (DbPath,logPath,ParaSetPassword,ExitPassword) VALUES ('"+m_strDbPath+"','"+m_strLogPath+"','"+m_strParaSetPassword+"','"+m_strExitPassword+"') ";<BR><BR>m_pCmd->CommandText=_bstr_t(sql);<BR><BR>m_pCmd->Execute(NULL,NULL,NULL);<BR><BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -