Subject | what's wrong with this syntax ? |
---|---|
Author | peppepolpo |
Post date | 2010-01-07T21:32:30Z |
I am using IBO 4.8.7 .
This syntax works:
procedure TfrmMain.itmTestClick(Sender: TObject);
var
i:integer;
s:string;
begin
with TIBOQuery.Create(self) do
try
databaseName:='cb4db';
sql.text:=
'select * from tb_emp '+
'where id_dpt in (''e4f071bc-c4a7-11de-b899-00219bfd1931'',''5fc7684c-750b-11de-835d-001560c9703c'')';
Open;
i:=RecordCount; //i=3 CORRECT
finally
Free;
end;
end;
this syntax does not work:
procedure TfrmMain.itmTestClick(Sender: TObject);
var
i:integer;
s:string;
begin
with TIBOQuery.Create(self) do
try
databaseName:='cb4db';
sql.text:=
'select * from tb_emp '+
'where id_dpt in (:id_dpt)';
Prepare;
ParamByName('id_dpt').AsString:=
'''e4f071bc-c4a7-11de-b899-00219bfd1931'',''5fc7684c-750b-11de-835d-001560c9703c''';
Open;
i:=RecordCount; // i=0 UNEXPECTED
finally
Free;
end;
end;
what is wrong with the latter code ?
Thank you
Peppe Polpo
This syntax works:
procedure TfrmMain.itmTestClick(Sender: TObject);
var
i:integer;
s:string;
begin
with TIBOQuery.Create(self) do
try
databaseName:='cb4db';
sql.text:=
'select * from tb_emp '+
'where id_dpt in (''e4f071bc-c4a7-11de-b899-00219bfd1931'',''5fc7684c-750b-11de-835d-001560c9703c'')';
Open;
i:=RecordCount; //i=3 CORRECT
finally
Free;
end;
end;
this syntax does not work:
procedure TfrmMain.itmTestClick(Sender: TObject);
var
i:integer;
s:string;
begin
with TIBOQuery.Create(self) do
try
databaseName:='cb4db';
sql.text:=
'select * from tb_emp '+
'where id_dpt in (:id_dpt)';
Prepare;
ParamByName('id_dpt').AsString:=
'''e4f071bc-c4a7-11de-b899-00219bfd1931'',''5fc7684c-750b-11de-835d-001560c9703c''';
Open;
i:=RecordCount; // i=0 UNEXPECTED
finally
Free;
end;
end;
what is wrong with the latter code ?
Thank you
Peppe Polpo