⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 subject_18468.htm

📁 一些关于vc的问答
💻 HTM
字号:
<p>
序号:18468 发表者:sdf 发表日期:2002-10-21 11:25:25
<br>主题:一个ADO访问数据库的问题
<br>内容:遇见一问题,在执行SQL语句时,好象有问题,不只为什么,是不是VC++中不能这样直接带参数啊?那应该怎么带参数 ?<BR>m_pCmd-&gt;CommandText="INSERT INTO SYSTEMPARAMETER (DbPath,logPath,ParaSetPassword,ExitPassword) VALUES ('"+m_strDbPath+"','"+m_strLogPath+"','"+m_strParaSetPassword+"','"+m_strExitPassword+"') ";<BR>m_pCmd-&gt;Execute(NULL,NULL,NULL);<BR>错误是:<BR>&nbsp;&nbsp;&nbsp;&nbsp; error C2664: 'PutCommandText' : cannot convert parameter 1 from 'class CString' to 'class _bstr_t'<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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-&gt;CommandText=_bstr_t(sql);<BR><BR>m_pCmd-&gt;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 + -