您好,我正在使用 Firebird (2.5) 作为数据库与 Firedac (Delphi Seattle) 合作,当我使用 TFDQuery 运行此查询时,没有返回任何记录:
SELECT ID FROM USERS WHERE PWD = 'êHÆ–!+'
数据库程序中与 IbExpert 相同的查询返回一条记录。 Firedac 组件是否有一些参数可以配置来解决这个问题。谢谢。
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;
另一种选择是转义常量字符或禁用宏预处理器。欲了解更多信息,请参阅特殊字符处理 http://docwiki.embarcadero.com/RADStudio/en/Preprocessing_Command_Text_(FireDAC)#Special_Character_Processing topic.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)