TSQLClientDataSet Eof

Posted on 2006-07-13
Last Modified: 2010-04-05
After I do TSQLClientDataSet.SaveToFile, Eof is true after LoadFromFile even the XML file have data content inside.

What seems to be the problem ?

Question by:andrewyu
  • 4
  • 2
LVL 26

Accepted Solution

Russell Libby earned 25 total points
ID: 17101618

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.


Author Comment

ID: 17105070
What do you meant by that ?
LVL 26

Expert Comment

by:Russell Libby
ID: 17105206
?? 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:

while not(DataSet.Eof) do
  ... export the record

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.

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.


Author Comment

ID: 17105278
So, you suggest to call DataSet.First; before import and and export first. am i correct ?
LVL 26

Expert Comment

by:Russell Libby
ID: 17105395

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.

LVL 26

Expert Comment

by:Russell Libby
ID: 17105477

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.

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Communication Between RC4 Delphi <-> PHP 3 123
Convert GUI app into console app for Win32 Env 5 109
update joined tables 2 55
shape, triangle, dbctrlgrid 3 17
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question