Handle rowupdating event
I added an event handler for the button by double- clicking on it and writing the code shown in listing 9-6.As you can see, I created a new Ole Db Data Adapter object and copied ole Db Data Adapter1 to it (the framework added ole Db Data Adapter1).You call the Fill Error event handler when the Fill method of data adapter of data adapter fails.Listing 9-3 shows the code for the Fill Error event handler.Data namespace You use the Data Column Change Event Handler as an event handler for Data Column when you are changing a value for a column in a Data Row.You use Data Row Change Event Handler as an event handler that handles the Row Changing, Row Changed, Row Deleting, and Row Deleted events of a Data Table.You call the Row Updated event handler when a row is updated using the Update method of a data adapter, and you call Row Updating when a row is updating.As you can see from Listing 9-5, you can compare the Statement Type member of Ole Db Row Updating Event Args to the Statement Type enumeration to find out the statement type.
Some of these classes and their usage may vary from provider to provider.The event handler receives an argument of type Fill Error Event Args, which contains data related to this event.The Fill Error Event Handler is as follows: Row Updated and Row Updating are two more events that a data adapter supports.The event argument class contains the related to the event, which can be accessed through event argument class members. As you can see from figure 9-1, event handler classes come from the Delegate class, and event argument classes come from the Event Args class.In this article, I'll show you how can handle events for ADO. Figure 9-1 Event handler and event argument classes defines in the System.