TAILIEUCHUNG - Exploring the DataAdapter and DataTable Events

Exploring the DataAdapter and DataTable Events You'll find all the code examples shown in this section in the program located in the ch11 directory. | Exploring the DataAdapter and DataTable Events You ll find all the code examples shown in this section in the program located in the ch11 directory. The listing for this program is omitted from this book for brevity. If you compile and run that program you ll see the order in which the events fire when you add modify and remove a row from a DataTable that contains rows retrieved from the Customers table. The DataAdapter Events The events exposed by a SqlDataAdapter object are shown in Table . Table SqlDataAdapter EVENTS EVENT EVENT HANDLER DESCRIPTION FillError FillErrorEventHandler Fires when an error occurs during a call to the Fill method. RowUpdating RowUpdatingEventHandler Fires before a row is added modified or deleted in the database as a result of calling the Update method. RowUpdated RowUpdatedEventHandler Fires after a row is added modified or deleted in the database as a result of calling the Update method. The FillError Event The FillError event fires when you call the Fill method and an error occurred. The following are a couple of scenarios that would cause an error An attempt is made to add a number from the database to a DataColumn that couldn t be converted to the .NET type of that DataColumn without losing precision. An attempt is made to add a row from the database to a DataTable that violates a constraint in that DataTable. The following example event handler named FillErrorEventHandler checks for the precision conversion error public static void FillErrorEventHandler object sender FillErrorEventArgs myFEEA if typeof A loss of precision occurred true The first parameter is an object of the class and it represents the object that raises the event. The second parameter is an object of the FillErrorEventArgs class which like all the EventArgs classes is derived from the class. The EventArgs class is the base .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.