Đang chuẩn bị liên kết để tải về tài liệu:
Merging Data

Không đóng trình duyệt đến khi xuất hiện nút TẢI XUỐNG

[ Team LiB ] Recipe 5.6 Merging Data Problem You have two DataSet objects with the same schema, but containing different data. You need to combine data from these two DataSet objects without creating duplicate rows. Solution Use the DataSet. | Team LiB Recipe 5.6 Merging Data Problem You have two DataSet objects with the same schema but containing different data. You need to combine data from these two DataSet objects without creating duplicate rows. Solution Use the DataSet.Merge method with the appropriate MissingSchemaAction enumeration values. The sample code contains four event handlers and a single method Form.Load Sets up the sample by creating two DataSet objects each with a single DataTable containing different subset of data from the Employees table in Northwind. The default view for each table is bound to a data grid on the form. MergeA Button.Click The first Button.Click calls the Merge method to merge the first DataSet into the second. MergeB Button.Click A second Button.Click calls the Merge method to merge the second DataSet into the first. Clear Button.Click A third Button.Click clears the data grid displaying the results of either merge. Merge This method takes two DataTable arguments. The first DataTable is copied to a new DataTable and the second DataTable is merged into it with the specified MissingSchemaAction. The default view of the result DataTable is bound to a data grid on the form. The C code is shown in Example 5-6. Example 5-6. File MergingDataForm.es Namespaces variables and constants using System using System.Configuration using System.Windows.Forms using System.Data using System.Data.SqlClient private SqlDataAdapter daA daB private DataSet dsA dsB . . . private void MergingDataForm_Load object sender System.EventArgs e Fill the schema and data for table A. String sqlText SELECT EmployeelD LastName FirstName Title FROM Employees WHERE EmployeelD BETWEEN 1 AND 5 Set up the DataAdapter and CommandBuilder for table A. SqlCommandBuilder cbA new SqlCommandBuilder daA daA new SqlDataAdapter sqlText ConfigurationSettings.AppSettings S ql_S qlAuth_ConnectString Define DataSet A and fill its table A with schema and data. dsA new DataSet A daA.FillSchema dsA SchemaType.Source .

TÀI LIỆU LIÊN QUAN
Đã 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.