delphi - ADOQuery.Filter 不适用于 LIKE

标签 delphi ms-access delphi-7 ms-access-2003

我在 ADOQuery2 中有一个查询。现在我想要一个过滤器:

  ADOQuery2.Filter := 'where Fname like ' + QuotedStr(Txt_Search.Text + '*');
  ADOQuery2.Filtered := true;

但它抛出此异常:(like 语句中的 * 是针对 Access 而不是 %)

enter image description here

有什么想法吗?

最佳答案

从 Access 本身内部使用 LIKE 运算符时,星号 * 是正确的通配符,但对于来自其他应用程序(例如您的应用程序)的 ADO 连接,您实际上应该使用 SQL 的“标准”百分号 % 通配符。

关于delphi - ADOQuery.Filter 不适用于 LIKE,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16330852/

相关文章:

ios - 德尔福 + iOS : How to declare simple ObjC-Class?

multithreading - Delphi线程返回值

sql-server-2005 - Access SQL 副本

Delphi 7 更新连接表

delphi - 使用 TChromium 时 LoadURL 出错

delphi - 无形式应用程序中的 TFDGUIxWaitCursor

forms - 如何在 Delphi 7 中使多个表单位于主表单之上,但不位于其他应用程序之上

sql - 从 MS Access 表中过滤最近 3 天的生日记录

ms-access - MS Access 2010 错误 - OLE 对象尝试插入对象 (.bmp) 失败

c++ - Delphi 和 C++ 类 VMT 兼容吗?