Re: TAdoQuery.LoadFromFile with D7-Access97
- From: Brian Bushay TeamB <BBushay@xxxxxxxxx>
- Date: Sat, 27 Aug 2005 09:47:10 -0500
The error in your logic is that loadfromFile is not importing the records.
SaveToFile and LoadfromFile are designed to function in a briefcase mode.
So that if you make changes to the file and save that file the changes are
recorded in the file. When you reconnect to the database and UpdateBatch only
your changes are applied.
Since you did a savetofile with out any changes Updatebatch sees no updadtes and
does not treat your records as new records.
You need to insert the records from the dataset you load the xml file from into
a second AdoDataset connected to your database then Updatebatch on that dataset
Brian
>I use D7 with a Access97 database.
>In one application i need to export one entire table to XML, delete the
>records from the table, and then reimport the XML file.
>The first part works ok, but i can't find a way to reimport the data in
>my table there are no records at all.
>
>This is the code:
>
>MainDM is a DataModule
>QR is a TAdoQuery
>
>MainDM.QR.SQL.Text := 'DELETE * FROM '+ExpFile;
>MainDM.QR.ExecSQL;
>
>MainDM.QR.CursorType := ctKeySet;
>MainDM.QR.LockType := ltBatchOptimistic;
>MainDM.QR.SQL.Text := 'SELECT * FROM TableName';
>MainDM.QR.Open;
>MainDM.QR.LoadFromFile(FileName);
>MainDM.QR.UpdateBatch(arAll);
>MainDM.QR.Close;
>
>Someone can help?
>
>
>Giorgio Forti
--
Brian Bushay (TeamB)
Bbushay@xxxxxxxxx
.
- References:
- TAdoQuery.LoadFromFile with D7-Access97
- From: user
- TAdoQuery.LoadFromFile with D7-Access97
- Prev by Date: Re: ADO Question
- Next by Date: MS Access table and field properties
- Previous by thread: TAdoQuery.LoadFromFile with D7-Access97
- Next by thread: ADO Question
- Index(es):