转:
http://blog.sina.com.cn/s/blog_670e606a0100m6io.html
写ADO数据库程序使用别人封装好的CADODatabase,CADORecordset类等, 用VS2005编译出以下问题: BOOL CADORecordset::Open(_ConnectionPtr mpdb, LPCTSTR lpstrExec, int nOption)
{
Close();
if(strcmp(lpstrExec, _T("")) != 0) //这行出问题
m_strQuery = lpstrExec;
.....
}
ado2.cpp(158) : error C2664: “strcmp”: 不能将参数 1 从“LPCTSTR”转换为“const char *”
还有
error C2664: “void ATL::CStringT
::Format(const wchar_t *,...)”: 不能将参数 1 从“const char [83]”转换为“const wchar_t *”
解决方法:
方法2:
在新建项目时,把使用UNICODE字符集取消,如下图:

方法3:
修改如下属性【字符集】的值为【使用多字节字符集】
如图:

这第三种我试过,选择"字符集"为"未设置"也行.
我是用第三种方法解决问题的, 用第二种方法也没把问题解决.
阅读(11636) | 评论(0) | 转发(1) |