However I found that I can subscribe to a tableadapters.adapter.rowupdated event directly from within code using the tableadpater as below entry?
If you're creating the adapter explicitly in your code, just add the call yourself. On Row Updated); However I would prefer to do this in the adapter's partial class so that the users of the dataset don't have to remember to add this code every time they create an instance of the adapter. v=14625 if you look at this video you can see, that you just double click on something in the dataset designer and the event gets generated and wired up for you...this works only for VB programmers :)) sux The Table Adapter class does not let you override End Init (no suitable method found to override).
I've put a bounty on this question because it's a problem I have had regularly since the days of 1.1 and I feel there must be a better solution to this than hacking the table adapter after I instantiate it. However you can use the extended method to wrap the Row Updated event and expose it to other classes (ie My Row Updated) The extension I have a possible alternative.
The code below is to resolve my particular issue with SQL CE to be able to update IDs on the table.
So, with the use of Extension Methods, I added two new methods to the Db Data Adapter abstract class that will allow the adding of event handlers for those two specific events, and here is my implementation (edited 4/23/2013 for handling of instance or static handler methods): I'm using the base Row Updated Event Args & Row Updating Event Args for the event arguments that get returned to the delegate, so if you need provider-specific members that are only available through the provider defined classes that are derived from the above two base event args classes, then they will need to be cast to those classes.
Otherwise, it works fine, and now I have provider-independent event handlers available from the Db Data Adapter class (which is how Microsoft should have implemented them to begin with). ''' Public Delegate Sub Row Updating Event Handler(sender As Object, e As Row Updating Event Args) Public Module Db Data Adapter Extension Sub New() End Sub Private Function Get Event(event Name As String, type As Type) As Event Info Return type.
During a call to the Update method of a Data Adapter, the database can send data back to your ADO.
NET application as output parameters or as the first returned record of a result set. NET can retrieve these values and update the corresponding columns in the Data Row being updated. NET calls the Accept Changes method of the Data Row after the update. call a method in the beginning before using this adapter (say in main form after you create instance of it).Whilst one can subscribe to the tableadapters underlying adapter in the tableadapter partial class I find you cannot easily initialise it without having to remember to call an initialisation of your own. Open() Dim adapter As New Sql Data Adapter() 'Set the UPDATE command and parameters. Update Command = New Sql Command( _ "UPDATE Schema. Update Command = New Sql Command( _ "UPDATE Table2 SET " _ & "[email protected], [email protected] WHERE Table One [email protected] One Id;", _ connection) adapter. Since this event is not well suited to client-side data-validation, what is a good (best practices) use of the event?