Improving Performance While Filling a DataSet

[ Team LiB ] Recipe Improving Performance While Filling a DataSet Problem Given a DataSet containing many related tables that takes a long time to fill | Team LiB Recipe Improving Performance While Filling a DataSet Problem Given a DataSet containing many related tables that takes a long time to fill you need to improve the performance. Solution Use the EnforceConstraints property of the DataSet and the BeginLoadData and EndLoadData methods of the contained DataTable objects to improve performance while filling a complex DataSet. The sample code contains one event handler and one method Go Times the filling of the DataSet created by the CreateDataSet method described next . The EnforceConstraints property of the DataSet is set as specified and the BeginLoadData and EndLoadData methods of the contained DataTable objects are used if specified. A DataAdapter is used to fill a specified DataSet with data from the Orders and Order Details tables in the Northwind database. Ten iterations are performed and the total fill time is returned in ticks which are 100-nanosecond intervals. CreateDataSet This method builds a DataSet containing the table schema for the Orders and Order Details tables from the Northwind database and creates a data relation between the tables. The DataSet is returned by the method. The C code is shown in Example 9-12. Example 9-12. File Namespaces variables and constants using System using using using using Table name constants public const String ORDERS_TABLE Orders public const String ORDERDETAILS_TABLE OrderDetails Field name constants for Orders table public const String ORDERID_FIELD OrderlD public const String CUSTOMERID_FIELD CustomerlD public const String EMPLOYEEID_FIELD EmployeeID public const String ORDERDATE_FIELD OrderDate public const String REQUIREDDATE_FIELD RequiredDate public const String SHIPPEDDDATE_FIELD ShippedDate public const String SHIPVIA_FIELD ShipVia public const String FREIGHT_FIELD Freight public const String SHIPNAME_FIELD ShipName public const .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
55    327    1    29-05-2024
Đã 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.