[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 258
  • Last Modified:

TSQLClientDataSet Eof

After I do TSQLClientDataSet.SaveToFile, Eof is true after LoadFromFile even the XML file have data content inside.

What seems to be the problem ?

Andrew
0
andrewyu
Asked:
andrewyu
  • 4
  • 2
1 Solution
 
Russell LibbySoftware Engineer, Advisory Commented:

Andrew,
I am guessing that the SaveToFile method walks the records during the save, leaving the current row pointer at the end. Sounds like you should issue a call to the DataSet First method in order to reset the cursor location.

Regards,
Russell
0
 
andrewyuAuthor Commented:
What do you meant by that ?
0
 
Russell LibbySoftware Engineer, Advisory Commented:
?? I am assuming you have some experience with datasets...

If the dataset is at EOF, then the dataset's cursor (current record) is located AFTER the last record in the dataset. The cause of this is most likely the SaveToFile performing something like:

DataSet.First;
while not(DataSet.Eof) do
begin
  ... export the record
  Dataset.Next;
end;

At the end of this, the DataSet's cursor is at the EOF marker. Meaning, you need to call TSQLClientDataSet.First in order to reset the cursor to the first record again.



Russell
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
andrewyuAuthor Commented:
So, you suggest to call DataSet.First; before import and and export first. am i correct ?
0
 
Russell LibbySoftware Engineer, Advisory Commented:

Yes on the after part...
As to the before part, I would imagine that the person (who wrote the export routine) already considered this and is doing it already. The easiest way to tell is to call the DataSet's .Last method, run the SaveToFile, and confirm that all the data is written out.

Russell
0
 
Russell LibbySoftware Engineer, Advisory Commented:

Btw, I didnt mean to infer that calling .First both before AND after would cause any problem. While it may be unnecessary calling it before the export, it should not hurt anything either.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now