DataRowVersion
組件: System.Data (在 System.Data.dll 中)
成員名稱 | 說明 | |
---|---|---|
Original | ||
Current | ||
Proposed | ||
Default |
-
DataRow object's BeginEdit method, if you change the value, the Current and Proposed values become available." data-guid="53d4c010ce3c8032a4beafa9dbdbb56b">在呼叫 DataRow 物件的 BeginEdit 方法之後,如果您變更值,則 Current 和 Proposed 值會變成可用的。 -
DataRow object's CancelEdit method, the Proposed value is deleted." data-guid="d1961856ae81db2d203538b7cd10bb48">在呼叫 DataRow 物件的 CancelEdit 方法之後,會刪除 Proposed 值。 -
DataRow object's EndEdit method, the Proposed value becomes the Current value." data-guid="f8e2bd0f669c22125d9d67237ada6efa">在呼叫 DataRow 物件的 EndEdit 方法之後,Proposed 值會變成 Current 值。 -
DataRow object's AcceptChanges method, the Original value becomes identical to the Current value." data-guid="c4fd48aa66edad91c2ec3ecd2bfc9fa5">在呼叫 DataRow 物件的 AcceptChanges 方法之後,Original 值會變成和 Current 值相同。 -
DataTable object's AcceptChanges method, the Original value becomes identical to the Current value." data-guid="c86f7db006e65dcf5c8b30adba76cca8">在呼叫 DataTable 物件的 AcceptChanges 方法之後,Original 值會變成和 Current 值相同。 -
DataRow object's RejectChanges method, the Proposed value is discarded, and the version becomes Current." data-guid="e114a0111666ff5a317a79a9fd2070bf">在撥號後DataRow物件的RejectChanges方法中, Proposed值會捨棄,而且版本變得Current。
privatestaticvoid CheckVersionBeforeAccept() { //Run a function to create a DataTable with one column. DataTable dataTable = MakeTable(); DataRow dataRow = dataTable.NewRow(); dataRow["FirstName"] = "Marcy"; dataTable.Rows.Add(dataRow); dataRow.BeginEdit(); // Edit data but keep the same value. dataRow[0] = "Marcy"; // Uncomment the following line to add a new value.// dataRow(0) = "Richard" Console.WriteLine(string.Format("FirstName {0}", dataRow[0])); // Compare the proposed version with the current.if (dataRow.HasVersion(DataRowVersion.Proposed)) { if (object.ReferenceEquals(dataRow[0, DataRowVersion.Current], dataRow[0, DataRowVersion.Proposed])) { Console.WriteLine("The original and the proposed are the same."); dataRow.CancelEdit(); } else { dataRow.AcceptChanges(); Console.WriteLine("The original and the proposed are different."); } } } privatestatic DataTable MakeTable() { // Make a simple table with one column. DataTable dt = new DataTable("dataTable"); DataColumn firstName = new DataColumn("FirstName", Type.GetType("System.String")); dt.Columns.Add(firstName); return dt; }