--如果delphi中,一个'用两个表示,则修改如下:Var MySQL: string; begin MySQL := 'select top 10 * from ai where fieldA in(''A'',''B'',''C'')';
Var MySQL: string; begin MySQL := replace('select select top 10 * from ai where fieldA in('+''''+'A'+''''+','+''''+'B'+''''+')',''',''''); ADO.Execute(MySQL) End;
你还是匹配的不够好。再仔细看看吧,
MySQL: string;
begin
MySQL := 'select top 10 * from ai where fieldA in(''A'',''B'',''C'')';
MySQL: string;
begin
MySQL := replace('select select top 10 * from ai where fieldA in('+''''+'A'+''''+','+''''+'B'+''''+')',''','''');
ADO.Execute(MySQL)
End;