Disconnected mode - data integrity.

  • Thread starter Thread starter arj
  • Start date Start date
A

arj

Using dataset we can perform various database operations in
disconnected mode... but how to ensure database integrity?

Suppose person A is updating some 100 rows of a database using one web
application (dataset). Records were read and then loaded in the web
page. Meanwhile somebody else (person B) has updated 20 rows out of
those 100 rows. Then A submits his updates from the web page. What
will happen to those 20 rows? Whose changes will be there, A or B? How
does disconnected mode operation handles this situation? Is it totally
application's responsibility to ensure this kind of data integrity?

I have worked with datasets, but have never had a situation like this.
Any kind of help will be greatly appreciated.

Thanx,
Arj.
 
Hi arj;

I had the similar problem but we were using SQL Server. You can add
additional field in
every table, the data type should be "timestamp". Its get updated
automatically whenever
row is updated or inserted. In a where clause of SQL command, check for
timestamp
field also. If it is same, then record is intact otherwise changed by some
other user.

Hope this help.

Javed.
 
The person B changes will be pernament.
The person A change on each of this 20 rows will fail and Dataset will throw
error
"Concurrently violation"

IF you do not want this error to be throw, you have to set
dataset.continueonerror= TRUE.

but you have to check Datatable.haserrors and row.geterror to get each
error message.




-In disconneted mode, the first person who update on a row will success.
-To avoid this problem, Don't used Commandbuilder to generate update and
delete command. write your own ,where you can you use PRIMARY KEY to
identify the row( Commandbuilder doesn't use primary key but make a
comparaison of all field of a row to identify a row)
 
Back
Top