TAdoQuery fetch data from Oracle.
The TClientDataSet gets data from the ADOQuery using a DataSetProvider.
When the changes are going to be saved to the database I have a set of
storeed procedures that i use to complete this task.
To know what should be done I set the filter on the ClientDataSet.
ClientDataSet.StatusFilter:=[usModified, usInserted, usDeleted];
While Not ClientDataSet.Eof Do
begin
if ClientDataSet.UpdateStatus=usModified then
begin
//Run Update Storeprocedure
end
//New
else if ClientDataSet.UpdateStatus=usInserted then
begin
//Run Insert Storeprocedure
end
//Delete
else if ClientDataSet.UpdateStatus=usDeleted then
begin
//Run Delete Storeprocedure
end;
ClientDataSet.Next;
end;
All this is working fine. The problem i have is when i creates a new row in
the grid and you forget to enter some data on that row so you go back to the
row again and fills in some more data.
Then this save loops got two insert status. The first contains the first set
of data the second row i conatins first and second data?
(only one new row in the grid but the loop above loops 2 times?)
Why is there 2 rows in the clientdataset? I only need one row with all data.
I havn't done any updates to the database or ApplyChanges... I dont get it!
Please give me ideas!
/Kristian Karlsson
John Pierce
--
Robert
Kristian Karlsson wrote in message <3d088cee$1_2@dnews>...
Possible ways out of this.
1) I ignore the ClientDataSet.StatusFilter:=[usModified, usInserted,
usDeleted]; row and goes through the complete
set and check UpdateStatus. It will go through a lot more rows but it works
Then I use ClientDataSet.StatusFilter:=[usDeleted] to remove the deleted
ones.
Works great!
2) Use the DataSetProvider.OnBeforeUpdateRecord and run my storeed
procedures there?
Does the OnBeforeUpdateRecord get one call per edit also?
"Robert Cerny" <robert.q...@neosys.xrs.qwe.si> wrote in message
news:aeb6i2...@neosys.xrs.si...
"John Pierce" <jpi...@healthplanning.com> wrote in message
news:3D08C4DE...@healthplanning.com...