Firedac select与Firebird一起使用不返回任何记录 [英] Firedac select working with Firebird returns no records

查看:169
本文介绍了Firedac select与Firebird一起使用不返回任何记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我正在使用Firebird(2.5)作为数据库使用Firedac(Delphi Seattle),当我使用TFDQuery运行此查询时,未返回任何记录:

Hello I'm working with Firedac (Delphi Seattle) using Firebird (2.5) as a database, when I run this query using a TFDQuery, no records are returned:

SELECT ID FROM USERS WHERE PWD = 'êHÆ–!+'

数据库程序中与IbExpert相同的查询返回一条记录. Firedac组件是否有一些要配置的参数可以解决此问题.谢谢.

The same query within a Database program as IbExpert return one record. Is there some parameter with Firedac components to configure that can solve this issue. Thanks.

推荐答案

它在查询字符串中,并且是字符.默认情况下,查询字符串是经过预处理的,并且必须转义常量字符,例如& :? {} ,否则它们用作特殊字符.

It's in the query string and it's the ! char. By default, query strings are preprocessed, and you must escape constant chars like !, &, :, ?, { or }, otherwise they are used as special chars.

您最好的选择是使用参数.这(除其他好处外)将从预处理的命令中删除该字符:

Your best option is using parameters. That will (except other benefits) get rid of that ! char from the preprocessed command:

FDQuery.SQL.Text := 'SELECT ID FROM USERS WHERE PWD = :Password';
FDQuery.ParamByName('Password').AsString := 'êHÆ–!+';
FDQuery.Open;

另一个选择是转义该常量char或禁用宏预处理程序.有关更多信息,请参见 特殊字符处理 主题.

Another option is escaping that constant char or disable macro preprocessor. For more information see the Special Character Processing topic.

这篇关于Firedac select与Firebird一起使用不返回任何记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆