tailieunhanh - Beginning Visual Basic .NET Database Programming phần 5
Tiếp theo, thêm thủ tục này đến lớp clsDatabase. Thủ tục này được gọi là từ các chức năng LoadCompleteDataSet tạo ra trước đó và kết quả đầu ra các thông tin DataSet cửa sổ Output. Viết dữ liệu vào cửa sổ đầu ra từ DataSet | Chapter 7 CREATE PROCEDURE AS select from categories RETURN 9. Next add this procedure to the clsDatabase class. This procedure gets called from the LoadCompleteDataSet function created previously and outputs the DataSet information to the Output window. Sub WriteCompleteDataSetToOutputWindow ByVal dsData As DataSet Write data to the output window from the DataSet Try Dim oRow As DataRow Dim strRecord As String write some data in the Products table to the Output window to show that the data is there. For Each oRow In Products .Rows strRecord Product Id oRow ProductId .ToString strRecord strRecord Product Name strRecord strRecord oRow ProductName .ToString strRecord strRecord Supplier Id strRecord strRecord oRow SupplierId .ToString strRecord Next write some data in the Suppliers table to the Output window to show that the data is there. For Each oRow In Suppliers .Rows strRecord Supplier Id oRow SupplierId .ToString strRecord strRecord Company Name strRecord strRecord oRow CompanyName .ToString strRecord strRecord Contact Name strRecord strRecord oRow ContactName .ToString strRecord Next write some data in the Categories table to the Output window to show that the data is there. For Each oRow In Categories .Rows strRecord Category Id oRow CategoryId .ToString strRecord strRecord Category Name strRecord strRecord oRow CategoryName .ToString strRecord strRecord Description strRecord strRecord oRow Description .ToString strRecord Next 32 Reading Data into the DataSet Catch error handling goes here UnhandledExceptionHandler End Try End Sub 10. Finally add the UnhandledExceptionHandler to the clsDatabase class Sub UnhandledExceptionHandler display an error to the user MsgBox An error occurred. Error Number _ Description Source End Sub How It Works In this section first we created a new class and .
đang nạp các trang xem trước