在c#对Access操作时,调了挺简单的模糊查询语句"select * from news where title like '%test%' order by addtime desc ",总返回0结果。
经网上查,其中一个原因是因为Access数据库Ansi编码,Ansi89支持通配符"*",而Ansi92支持通配符“%",我用的是Access2000,转换成2003后同样只能用”* ",也不知道Ansi编码在哪里设置,不过好在用Access里的查询可以得到要的结果了。
但在C#中执行“select * from news where title like '*test*' order by addtime desc ",还是得到0结果。继续网上找,看到有碰到同样问题的朋友,用instr函数间接解决此问题。
最终语句"select * from news where InStr(1,LCase(title),LCase('test'),0)<>0 order by addtime desc"。
Access,再一次服了you