You are not logged in.
Pages: 1
Today I have used the FillOne method but I have a problem, see the code:
CustomerRecord := TSQLInvoicesCustomers.Create(Database,'IDInvoice="%"',[IntToStr(InvoiceID)]);
try
while CustomerRecord.FillOne do
begin
...
...
end;
finally
CustomerRecord.Free;
end;
Now the problem, if there are more of 1 record on CustomerRecord the code works, but if there are ONLY 1 record the code not work, I think because FillOne return False.
I think FillOne should work with 1 ore more records, right? In fact I cannot know how many records CustomerRecord can retrieve. Can you check this? Thanks.
Offline
1. There is no need of using IntToStr() in the open array: just put [InvoiceID].
2. You are not using the good method.
You should call CreateAndFillPrepare() constructor instead of Create() here, as stated by the documentation.
Offline
OK but can CreateAndFillPrepare works also with a single record without use the loop? Or I need use Create if I have a record and CreateAndFillPrepare if I have more that one record?
Offline
As stated by the documentation:
- Use Create + an ID or a Where clause to retrieve one record;
- Use CreateAndFillPrepare to retrieve one or more records - but you need the loop, or at list one FillOne call for a single record.
Offline
Is there a way to add ORDER command to CreateAndFillPrepare method? I need use CreateAndFillPrepare (to avoid a simple SQL) but I need ORDER the results, is it possible?
I have read the documentation but I cannot find a "ORDER" parameter for CreateAndFillPrepare.
Another think, when I use Create or CreateAndFillPrepare, to know if there are some result I can check "if CustomerRecord <> nil", is it right?
Thanks
Offline
To get the count of the records, for example sql: "SELECT COUNT(*) FROM Projects" I need use ExecuteList or is there a "Framework" system?
Sorry for these questions but I'm check to remove all ExecuteList, when I can, from my application.
Offline
Pages: 1