Đang chuẩn bị liên kết để tải về tài liệu:
Creating an XML File That Shows Changes Made to a DataSet

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

[ Team LiB ] Recipe 8.8 Creating an XML File That Shows Changes Made to a DataSet Problem When you use the GetXML( ) method of the DataSet, you may see only the current values in the DataSet. You want to get the original values and see which rows were added, edited, or deleted. Solution Create an XML DiffGram | Team LiB Recipe 8.8 Creating an XML File That Shows Changes Made to a DataSet Problem When you use the GetXML method of the DataSet you may see only the current values in the DataSet. You want to get the original values and see which rows were added edited or deleted. Solution Create an XML DiffGram which is a document that details the modifications made to a DataSet. The sample code contains two event handlers and a single method Form.Load Sets up the sample by loading the Categories table from Northwind into a DataSet and displays the DiffGram for the DataSet before modification. Make Changes Button.Click Deletes the first row modifies the second row inserts a row before the first row and adds a row to the end of the Categories DataTable DisplayDiffGram This method outputs the DiffGram for the DataSet to both a file and to a textbox on the form. The C code is shown in Example 8-12. Example 8-12. File XmlDiffgramForm.cs Namespaces variables and constants using System using System.Configuration using System.Text using System.IO using System.Xml using System.Xml.Schema using System.Data using System.Data.SqlClient Table name constants private const String CATEGORIES_TABLE Categories Field name constants private const String CATEGORYNAME_FIELD CategoryName private const String XMLDIFFGRAMFILENAME ConfigurationSettings.AppSettings Temp_Directory CategoriesDiffgram.xml private DataSet ds . . . private void XmlDiffgramForm_Load object sender System.EventArgs e Select fields from Categories table without the Picture BLOB. String sqlText SELECT CategorylD CategoryName Description FROM Categories Load the Categories table into the DataSet. SqlDataAdapter da new SqlDataAdapter sqlText ConfigurationSettings.AppSettings S ql_ConnectString ds new DataSet da.Fill ds Categories DisplayDiffGram private void makeChangesButton_Click object sender System.EventArgs e Disable the make changes button. makeChangesButton.Enabled false DataTable dt ds.Tables Categories Delete the first .

Đã 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.