O'Reilly logo

.NET Framework 4.5 Expert Programming Cookbook by A.P. Rajshekhar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using transactions to maintain database consistency when saving multiple files

When saving or updating a set of records in a table or across multiple tables, scenarios occur for which the set should be saved as a whole. In other words, if saving or updating of any record fails, then no further inserts or updates of any of the records within that set should happen. Also, the records saved till that point should be removed. For example, when trying to save seven images, if saving the fifth image fails, then the next two images should not be saved. And the first four saved images must be removed from the table. This is required to maintain consistency of the database. In such a scenario, transactions comes into the picture.

ADO.NET provides the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required