What I'm doing is very simple.
for each record that is edited I do a Post that is always followed by an ApplyUpdates(-1).
So, at no moment the Delta has more than one record.
The OnReconcileError event handler has the following:
Action:= HandleReconcileError(DataSet,UpdateKind, E);
which is almost always showing me an error that says that the record has been changed by another user.
But that is impossible because I am the only user of the system and even if I refresh the ClientDataSet (close & open)
or restart the application the exception persists being raised.
I found out that if I insert a record and then modify it once or twice it becomes impossible to modify it again because the exception I mentioned never stops being raised even if I go home and come back next day.
I don't know what I am doing wrong.
(Delphi 5, Windows 98, SQL Server 7.0, BDE 5.01)
somebody please help me.
Thanks
Look at your commits and make sure every starttrans has a commit or rollback
and the every database/recordset open has a cooresponding close.
Mike
Santos <dsanto...@hotmail.com> wrote in message
news:3b1bf47d$1_1@dnews...
"Santos" <dsanto...@hotmail.com> wrote in message
news:3b1bf47d$1_1@dnews...
>
If you're using dates in the record then try using the ShortDateFormat (e.g. ShortDateFormat := 'dd/mm/yyyy' ) variable for both your inputs and outputs so that the values for these fields is the same coming out as
it is going in. You might also want to consider the ProviderFlags property of each field in your dataset. Set the pfInkey flag to true for each field that forms the key for that dataset.
Then set the provider's UpdateMode property to UpWhereKeyOnly, meaning that the application should search for the record by its key only.
Then add the following code to the OnBeforePost event handler of the Provider.
procedure DataModule.DataSetBeforePost(
DataSet: TDataSet);
begin
DataSet.FieldByName('DateField').AsString :=formatDateTime('dd/mm/yyyy',DataSet.FieldByName('DateField').AsDateTime);
end;
The data you entered previously in your system may also need to be deleted and re-entered as when the applyupdates method is triggered, it checks each and every record and if one of them doesn't match what you have
in your database then it will throw back a 'Record has been changed by another user'.
I may not have explained this very well, but I hope it will maybe even give you a few ideas.
David
Santos wrote:
--
David Thomson
****************************************************************************
The information in this E-mail is confidential and is intended solely for
the addressee or someone authorised to receive the addressee's E-mail. Any
views or opinions presented are solely those of the author and do not
necessarily represent those of the University of Glasgow. The University
accepts no liability for the content of this e-mail, or the consequences of
any actions taken on the basis of the information provided.
****************************************************************************
The problem was the precision of the TDateTime fields as you
and Patrick said.
Now I am doing as you said
DataSet.FieldByName('DateField').AsString :=formatDateTime('dd/mm/yyyy',DataSet.FieldByName('DateField').AsDateTime);
and my application is running smoothly.
I did not change the properties of the TFields and my provider is working with UpdateMode UpWhereAll and I don't feel the necessity of changing it now.
Thank all of you.