VS2005设置Unicode或ASCII字符集问题
2013-03-13 22:04
295 查看
在做VC连接数据库操作时报错如下:
e:\recv-data\inserttodb\pgdb.cpp(213) : error C2664: 'SQLConnectW' : cannot convert parameter 2 from 'SQLCHAR *' to 'SQLWCHAR *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
e:\recv-data\inserttodb\pgdb.cpp(266) : error C2664: 'SQLExecDirectW' : cannot convert parameter 2 from 'SQLCHAR *' to 'SQLWCHAR *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
e:\recv-data\inserttodb\pgdb.cpp(284) : error C2664: 'SQLExecDirectW' : cannot convert parameter 2 from 'SQLCHAR *' to 'SQLWCHAR *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
e:\recv-data\inserttodb\pgdb.cpp(300) : error C2664: 'SQLExecDirectW' : cannot convert parameter 2 from 'SQLCHAR *' to 'SQLWCHAR *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
原因:
VS2005中开发程序时,默认的字符集是Unicode。所以如果程序中使用字符串常量时一定要显示转换为Unicode型,否则编译时报错
解决方法:
项目菜单--项目属性(最后一个)--配置属性--常规--项目默认值--字符集,将使用Unicode字符集改为未设置即可。
相关文章推荐
- VS2005设置UNICODE或ASCII字符集问题[转]
- VS2005设置UNICODE或ASCII字符集问题
- VS2005设置Unicode或ASCII字符集问题
- VS2005设置Unicode或ASCII字符集问题
- 刚发现了一个问题,关于vs2005 datagridview的,我发现在设计行标头的HeaderCell.Value的时候要是设置RowTemplate.Height 的值>= 17则行标头的那个黑三角就显示出来了,要是小于17就不能显示了,想问问大家,是怎么回事?
- VS2005有些页面设置断点无效的问题
- vs2005设置断点不能调试问题
- vs2005 MFC界面自绘图形BMP按钮时,设置按钮的位置问题
- vs2005-vs2008 设置断点无效的问题
- tornado中设置cookie时的unicode问题(经验都是慢慢积累的)
- VS2005中CString与其他格式的转换 (UNICODE字符集带来的问题)
- vs2005-vs2008 设置断点无效的问题
- VS2005默认使用Unicode字符集的问题
- vs2005设置断点不能调试问题(方法三为首选项,一般都可以解决)
- VS2005中UNICODE和ANSI以及MBCS的问题
- vs2005空工程不能设置断点问题.
- VS2005默认使用Unicode字符集的问题
- “error PRJ0050: 未能注册输出。请确保您有修改注册表的相应权限。” 上网找了一下次问题的解决方案 工程设置的问题,VS2005建的STL工程中默认的设置是: ALT的使用:动态链接到 A
- vs2005 unicode问题的解决
- 使用sqlAlchemy和mysqldb时unicode的设置问题