When multiple users attempt to modify data at the same time, controls need to be established in order to prevent one user's modifications from adversely affecting modifications from simultaneous users.
In general, there are three common ways to manage concurrency in a database:
How to handle "Last in wins" concurrency method in WinSchedule control? Can someone give me an example code?
try
{
this.DataAdapterForAppointments.Update( this.DataSet, WinScheduleDatabaseSupportBase.APPOINTMENTS_TABLE_NAME);
}
catch (DBConcurrencyException dbcx)
// How to handle "Last in wins" concurrency method?
// Can someone give me an example code
Thanks in advance, Lello
this.myDataAdapterForAppointments.Update( this.myDataSet, “Appointments” );
catch (DBConcurrencyException)
No violation concurrency exception will never be generated;
Regards, Lello
So it should work:
this.DataAdapterForAppointments.Update( this.DataSet, “Appointments” );
DataTable tempAppointmentsDataTable = new DataTable();
this.DataAdapterForAppointments.Fill(tempAppointmentsDataTable);
this.dataSet.Merge(tempAppointmentsDataTable, true, MissingSchemaAction.Add);
Is there a better way?
The point of the 'WinSchedule Database Demo' sample, for which the class you mention here was created, was to demonstrate the basic approach of connecting the Owners and Appointments collection to a database. There are many articles on the general topic of record locking included in MSDN, which you can refer to if you want to learn more about that subject.
Is not a general question because it concerns your class "WinScheduleDatabaseSupportBase" (where are missing the functions to manage concurrency). Thanks, however, for help.
This question is a general one on the subject of how to properly handle data concurrency exceptions; the following MSDN article provides some guidance.
How you enforce user access restrictions is not something that the WinSchedule data binding layer gets involved with - it is a function of the data source itself.