tailieunhanh - Edit Data and Update Changes That Are Made to an ADO.NET

4,1 Chỉnh sửa dữ liệu và cập nhật thay đổi Đó là xứ cho một đối tượng DataSet danh mục và xem dữ liệu dễ dàng. Những gì bạn thực sự cần phải làm là để có thể chỉnh sửa và cập nhật dữ liệu. | Edit Data and Update Changes That Are Made to an DataSet Object Listing and viewing data is easy. What you really need to do is to be able to edit and update data. You know you can use the DataSet object and some of its objects and methods to perform this task. How do you edit and update data using the DataSet object Technique In this How-To you will use the DataAdapter DataSet DataTable and DataRow objects. You have experienced some of the properties and methods of each of these objects before. In this chapter you are going to be using the following properties and methods that are shown in Table . Table . DataAdapter DataSet DataTable and DataRow Properties and Methods Object Method Property Description DataAdapter Fill Fills DataSet and DataTable objects. CommandBuilde r GetUpdateComman d Creates an Update command and places it into the data adapter s UpdateCommand property. DataAdapter UpdateCommand Holds the SQL statement for the update. DataAdapter Close Closes the connection off the UpdateCommand. The syntax is . DataAdapter Update Performs the update command against the dataset. DataSet Tables Represents a collection of tables found within a dataset. DataSet Rows Contains a collection of rows within a specified table in a dataset. DataSet AcceptChanges Sends the changes back to the server. DataRow ToString Retrieves the data from the column that is specified in the DataRow and returns it as a string value. DataRow BeginEdit Begins the editing of a DataRow allowing you to replace values in the columns. DataRow EndEdit Completes the editing of a DataRow. You will see these objects with their properties and methods used in the following steps. Steps Open and run the 4 solution. From the main form click on the command button with the caption How-To . When the form loads click on the Load List button to display the customers that begin with the letter A. Click the Edit button. You will .