I’ve been doing some more work with TableAdapters and transactions. I’ve learned how to extend the TableAdapter class to include support for handling transactions. Being able to extend a class to override a method or provide new methods is an advanced programming technique that is frequently suggested but rarely demonstrated. Numerous times I will read that a class can be extended to do this or that but there are never any instructions on how to do it. I had to figure it out for myself in this particular case.
I was able to create a transaction scope for multiple TableAdapter’s Insert commands so I can roll back several related changes to database tables. This required a reference to System.Transactions which is new to NET Framework 2.0 so I cannot use this technique in ASP.NET 1.1. However, you don’t have strongly typed datasets in the previous version of the NET Framework so there is no need to extend TableAdapter classes.