Board index » delphi » ClientDataSet SaveToFile problem

ClientDataSet SaveToFile problem


2004-04-07 04:26:45 AM
delphi210
So I replaced a horribly slow COM/ActiveX single-tier app with a
ClientDataSet. Performance is fantastic, everything is great. Then I
realize that I am not doing enough savetofile calls, as I wnat the data
to be as current as possible in the event that the app/pc shuts down
unexpectedly. So I am testing this by loading up the cds, then killing
the app. When the app is restarted, the data is there as I expect. But
then attempting to do further saveToFile calls is leading to
EFCreateError exceptions, claiming it cannot create the file "mycds.cds".
Now I have never seen this kind of behavior before, and I am a bit
puzzled as to what could be going on.
This is D5.
Any ideas greatly appreciated!
Brad
 
 

Re:ClientDataSet SaveToFile problem

In article <XXXX@XXXXX.COM>,
XXXX@XXXXX.COM says...
Quote
So I replaced a horribly slow COM/ActiveX single-tier app with a
ClientDataSet. Performance is fantastic, everything is great. Then I
realize that I am not doing enough savetofile calls, as I wnat the data
to be as current as possible in the event that the app/pc shuts down
unexpectedly. So I am testing this by loading up the cds, then killing
the app. When the app is restarted, the data is there as I expect. But
then attempting to do further saveToFile calls is leading to
EFCreateError exceptions, claiming it cannot create the file "mycds.cds".

Now I have never seen this kind of behavior before, and I am a bit
puzzled as to what could be going on.

This is D5.

Any ideas greatly appreciated!

Brad

Where is that file being created??
It's possible tht the OS still flags the file as "open" and is giving
you an error as a result. If you delay a while or reboot the PC, does
the problem go away??
Allen.
 

Re:ClientDataSet SaveToFile problem

G. Allen Casteran writes:
Quote
In article <XXXX@XXXXX.COM>,
XXXX@XXXXX.COM says...

>So I replaced a horribly slow COM/ActiveX single-tier app with a
>ClientDataSet. Performance is fantastic, everything is great. Then I
>realize that I am not doing enough savetofile calls, as I wnat the data
>to be as current as possible in the event that the app/pc shuts down
>unexpectedly. So I am testing this by loading up the cds, then killing
>the app. When the app is restarted, the data is there as I expect. But
>then attempting to do further saveToFile calls is leading to
>EFCreateError exceptions, claiming it cannot create the file "mycds.cds".
>
>Now I have never seen this kind of behavior before, and I am a bit
>puzzled as to what could be going on.
>
>This is D5.
>
>Any ideas greatly appreciated!
>
>Brad
>


Where is that file being created??

It's possible tht the OS still flags the file as "open" and is giving
you an error as a result. If you delay a while or reboot the PC, does
the problem go away??

Allen.

Yes this is all I could think of as well. it is possible that it is some
kind of wier permissions problem as well. This is on an XP "network",
with no logins or anything, and the Output directory for the app is on
the file server, not my box. And when I have run it solely on my box, it
appears to be working right. It was just such an odd thing, that I've
never seen before in many years of working with cds files. Thanks for
the ideas.
Brad
 

Re:ClientDataSet SaveToFile problem

Quote
Yes this is all I could think of as well. it is possible that it is some
kind of wier permissions problem as well. This is on an XP "network",
with no logins or anything, and the Output directory for the app is on
the file server, not my box. And when I have run it solely on my box, it
appears to be working right. It was just such an odd thing, that I've
never seen before in many years of working with cds files. Thanks for
the ideas.

Brad
Bingo. With that information it is clear that your problem is the delay
in the XP "server" closing the old connection to your workstation. When
the WS crashes, it takes a while for the server to notice that its no
longer there. Until that time the server still has the WS's files open
on the server. As Far as your app is concerned another station has the
file open and locked.
Allen.
 

Re:ClientDataSet SaveToFile problem

G. Allen Casteran writes:
Quote
>Yes this is all I could think of as well. it is possible that it is some
>kind of wier permissions problem as well. This is on an XP "network",
>with no logins or anything, and the Output directory for the app is on
>the file server, not my box. And when I have run it solely on my box, it
>appears to be working right. It was just such an odd thing, that I've
>never seen before in many years of working with cds files. Thanks for
>the ideas.
>
>Brad


Bingo. With that information it is clear that your problem is the delay
in the XP "server" closing the old connection to your workstation. When
the WS crashes, it takes a while for the server to notice that its no
longer there. Until that time the server still has the WS's files open
on the server. As Far as your app is concerned another station has the
file open and locked.

Allen.

However, I am getting the same error in my app and everything is local.
I'm running D6Pro on XPHome. My CDSs are loaded from (and ostensibly saved to)
paths like
.\data\Reviews.cds
What's even more odd about this is that it seems to be happening only under
circumstances where I let the user open a file dialog to retrieve a filename
which is then put into a field on the form. All they need is the file name, not
the path, and everything seems to work as expected until I try to close the CDS
(thus writing it to disk). I get the EFCreateError exception, and no changes
get saved.
Pete