How to make sure datasource and datatable are updated for application with multiple users
Posted on 2008-11-19
I have a project with a central application (used by multiple users) and a decentral application (each used by one user). The applications communicate by xml files. In the central application booking lines are created and these are send to the decentral application.
The central and decentral application both have an SQL datasource with BookingID (primairy key with auto numbering) and BookingNumber column. I have used FillSchema to make sure the BookingID is always unique.
The BookingNumber column must also be unique. Most BookingNumbers are created by the central application but I also receive BookingNumbers from the decentral applications. Therefore I can not use autonumbering. The solution I have choosen (with help from experts-exchange) is to first update, empty and fill the datatable and then add 1 to the highest found BookingNumber during the save operation. After creating the row I again update the SQL datasource to make sure the highest BookingNumber is available for other users.
I have not tested the method above with multiple users, but I believe it should work. However it seems like a lot of roundtrips to the SQL datasource. My question therefore is: is this the normal way of working or is there a better solution?