I am attempting to move to the Provider Independent classes for Data access. Mostly it is going well but I have hit a wall trying to setup the RowUpdated event on a DataAdapter. Using the OleDb classes I would use:
System.Data.OleDb.OleDbDataAdapter da;
// set up dataset and read table etc......
da.RowUpdated += new System.Data.OleDb.OleDbRowUpdatedEventHandler(My_RowUpdated);
Unfortunately the System.Common.DbDataAdapter class does not appear to have a public RowUpdated event handler and so I have to use some casting to make it work:
((System.Data.OleDb.OleDbDataAdapter)da).RowUpdated += new System.Data.OleDb.OleDbRowUpdatedEventHandler(My_RowUpdated);
Am I missing something here Is there a way to achieve this without involving provider specific casts
Thanks
Permjeet

RowUpdated event for Provider Independent DataAdapter
Elaine.Wong
After some more investigation I missed the fact that TableAdapters generated are partial classes. It might be possible to add a provider independent RowUpdated event by this means (although I'm still skeptical strongly typed datasets can be made provider independent).
- Ray
Eric Wellnitz
I've hit this same wall. I'm relatively new to provider indepenent code so perhaps I'm missing something, but there seems to be a lot of dataprovider specific code that needs to be written all across the data access model.
The SqlException class is another problem I hit. i.e. there isn't a provider independent error handling model as far as I can tell.
Building connection strings also seems to be provider specific.
If your missing something, so am I.
- Ray
Futzy
BTW: the context of my post was in trying to determine how to do this with a strongly typed dataset. You'd think that if provider independence was truely possible, then stronly typed datasets would be provider independent. Unfortunately, the code generated is littered with provider specific types. I'm guessing strongly typed datasets and provider independence are mutually exclusive.
Not only that, the TableAdapters generated in strongly typed datasets hide the underlying DataAdapter by making it private. So, you can't even get to the adapter to hook the event.
Additionally, the TableAdapter calls the DataAdapter directly for updates rather than calling a virtual method. If it had called a virtual method on the TableAdapter for updates, the update routine _might_ be able to be hooked through a custom base class of the TableAdapter; giving the opportunity to supply your own RowUpdated event in the TableAdapter class (which, from the public interface appears to be provider independent).
- Ray