Solved

TSQLClientDataSet Eof

Posted on 2006-07-13
8
249 Views
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 ?

Andrew
0
Comment
Question by:andrewyu
  • 4
  • 2
8 Comments
 
LVL 26

Accepted Solution

by:
Russell Libby earned 25 total points
Comment Utility

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
 

Author Comment

by:andrewyu
Comment Utility
What do you meant by that ?
0
 
LVL 26

Expert Comment

by:Russell Libby
Comment Utility
?? 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:andrewyu
Comment Utility
So, you suggest to call DataSet.First; before import and and export first. am i correct ?
0
 
LVL 26

Expert Comment

by:Russell Libby
Comment Utility

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
 
LVL 26

Expert Comment

by:Russell Libby
Comment Utility

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

743 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now