Subject | RE: [IBO] what's wrong with this syntax ? |
---|---|
Author | Svein Erling Tysvær |
Post date | 2010-01-08T09:08:27Z |
Your first query counts the number of rows where id_dpt is either
e4f071bc-c4a7-11de-b899-00219bfd1931 or
5fc7684c-750b-11de-835d-001560c9703c
The second query counts the number of rows where id_dpt is
e4f071bc-c4a7-11de-b899-00219bfd1931','5fc7684c-750b-11de-835d-001560c9703c
I.e. your second query checks for the existence of one value that includes both apostrophe and comma.
Set
-----Original Message-----
From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com] On Behalf Of peppepolpo
Sent: 7. januar 2010 22:33
To: IBObjects@yahoogroups.com
Subject: [IBO] what's wrong with this syntax ?
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
e4f071bc-c4a7-11de-b899-00219bfd1931 or
5fc7684c-750b-11de-835d-001560c9703c
The second query counts the number of rows where id_dpt is
e4f071bc-c4a7-11de-b899-00219bfd1931','5fc7684c-750b-11de-835d-001560c9703c
I.e. your second query checks for the existence of one value that includes both apostrophe and comma.
Set
-----Original Message-----
From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com] On Behalf Of peppepolpo
Sent: 7. januar 2010 22:33
To: IBObjects@yahoogroups.com
Subject: [IBO] what's wrong with this syntax ?
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