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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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.

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!


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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

729 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