access database在vc ++中选择unicode错误 [英] access database select unicode error in vc++
问题描述
访问数据库中的数据是:
下载演示代码: http://files.cnblogs.com/songtzu/ADO.rar [ ^ ]
the data in access db is this:
download demo code:http://files.cnblogs.com/songtzu/ADO.rar[^]
m_Conn.SetConnectionString("Provider=Microsoft.Jet.OLEDB.4.0; Data Source= TestDb.mdb;Jet OLEDB:DataBase password=1314;");
m_Conn.Open("","","",ConnectOption::adConnectUnspecified);
m_Cmd.SetActiveConnection(m_Conn);
我的db连接代码是这样的:
电子邮件
yangxb@126.com
chenki@163.com
Liugob@126.com333
Tangyl@yahoo.com
Zhangzd@hotmail.com
dfgd @ eter .com
中文邮箱@ gmail.com
中文邮箱@ gmail.com
try@gmail.com
我试图使用select like来获取try@gmail.com
这里是我的vc ++代码:
m_Cmd.SetCommandText(select * from Phone where LIKE'%try%');
它会提示未找到数据
如果我尝试选择第一个unicode文本中文邮箱@ gmail.com:
m_Cmd.SetCommandText( 选择*来自电话,电子邮件喜欢'%中文'';
它有正确的结果。这是访问的错误吗?
my db connect code is this:
Email
yangxb@126.com
chenki@163.com
Liugob@126.com333
Tangyl@yahoo.com
Zhangzd@hotmail.com
dfgd@eter.com
中文邮箱@gmail.com
中文邮箱@gmail.com
try@gmail.com
I trid to use "select like " to get "try@gmail.com"
here is my vc++ code:
m_Cmd.SetCommandText("select * from Phone where Email LIKE '%try%' ");
it would prompt "not data found"
if I try to select the first unicode text "中文邮箱@gmail.com" by this:
m_Cmd.SetCommandText("select * from Phone where Email LIKE '%中文%' ");
It has right result.Is this access's bug?
推荐答案
看看这里: 如何从Access 2010查询Unicode SQL表列 [ ^ ]。它可能会有所帮助。
Have a look here: How to Query a Unicode SQL table column from Access 2010[^]. It might help.
这篇关于access database在vc ++中选择unicode错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!