出错了,请指教.

hljqfl 2006-06-09 09:12:15
_RecordsetPtr m_trecordset;
m_trecordset.CreateInstance(__uuidof(Recordset));
m_trecordset->Open("select * from 表名", theApp.m_pConnection.GetInterfacePtr(), adOpenStatic,adLockOptimistic,adCmdText);

这样可以,
如果
str_sql=Open("select * from 表名");
m_trecordset->Open(str_sql, theApp.m_pConnection.GetInterfacePtr(), adOpenStatic,adLockOptimistic,adCmdText);

提示错误信息,是类型转换问题,不知该如何解决.
cannot convert from 'class CString' to 'const class _variant_t'
...全文
87 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
hrbqfl 2006-06-11
  • 打赏
  • 举报
回复
m_trecordset->Open(LPCTSTR(str_sql), theApp.m_pConnection.GetInterfacePtr(), adOpenStatic,adLockOptimistic,adCmdText);

hljqfl 2006-06-11
  • 打赏
  • 举报
回复
up
Qiushen 2006-06-09
  • 打赏
  • 举报
回复
你的参数里本来就要求是一条文本命令,adCmdText

4,011

社区成员

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

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