在delphi字符中包括单引号(')

Delphi中,用interbase控件访问InterBase数据库,并设置Dialect 3模式访问时,SQL语句中引用的 字符型字段 需要放在单引号(')内,如要在Delphi的IBQuery中实现该操作:

select * from MyTable where name='zmxjh'

可以这样做:

SQL := 'select * from MyTable where name= ''%s'' ';
SQL := format(SQL,['zmxjh']);

用两个单引号 ('')即可在字符串包括单引号.

Published At
Categories with Web编程
Tagged with
comments powered by Disqus