当前位置: 首页>>代码示例>>C#>>正文


C# DataTable.RejectChanges方法代码示例

本文整理汇总了C#中System.Data.DataTable.RejectChanges方法的典型用法代码示例。如果您正苦于以下问题:C# DataTable.RejectChanges方法的具体用法?C# DataTable.RejectChanges怎么用?C# DataTable.RejectChanges使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Data.DataTable的用法示例。


在下文中一共展示了DataTable.RejectChanges方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GrabarArticulosAgrupar

 public static void GrabarArticulosAgrupar(DataTable tblStock, DataTable tblArticulos, ref int? codigoError)
 {
     MySqlTransaction tr = null;
     try
     {
         MySqlConnection SqlConnection1 = DALBase.GetConnection();
         tr = SqlConnection1.BeginTransaction();
         DAL.ArticulosDAL.BorrarArticulosAgrupar(tblArticulos, SqlConnection1, tr);
         DAL.StockDAL.Update(tblStock, SqlConnection1, tr);
         tr.Commit();
         SqlConnection1.Close();
     }
     catch (MySqlException ex)
     {
         switch (ex.Number)
         {
             case 1042: //Unable to connect to any of the specified MySQL hosts.
                 tblStock.RejectChanges();
                 tblArticulos.RejectChanges();
                 codigoError = 1042;
                 break;
             case 0: // Procedure or function cannot be found in database
                 tblStock.RejectChanges();
                 tblArticulos.RejectChanges();
                 codigoError = ex.Number;
                 break;
             default:
                 tblStock.RejectChanges();
                 tblArticulos.RejectChanges();
                 if (tr != null)
                 {
                     tr.Rollback();
                 }
                 codigoError = ex.Number;
                 break;
         }
     }
     catch (TimeoutException)
     {
         codigoError = 8953; // El número 8953 lo asigné al azar
     }
     catch (NullReferenceException)
     {
         codigoError = 8954; // El número 8954 lo asigné al azar
     }
     catch (Exception)
     {
         codigoError = 8955; // El número 8955 lo asigné al azar
     }
 }
开发者ID:BenjaOtero,项目名称:trend-gestion-desktop,代码行数:50,代码来源:TransaccionesBLL.cs

示例2: GrabarDB

 public static void GrabarDB(DataTable tblUsuarios)
 {
     try
     {
         DAL.ColoresDAL.GrabarDB(tblUsuarios);
     }
     catch (MySqlException ex)
     {
         MessageBox.Show(ex.ToString(), "NcSoft", MessageBoxButtons.OK, MessageBoxIcon.Information);
         tblUsuarios.RejectChanges();
     }
 }
开发者ID:BenjaOtero,项目名称:trend-gestion-desktop,代码行数:12,代码来源:UsuariosBLL.cs

示例3: setModified_testRollback

		public void setModified_testRollback()
		{
			DataTable table = new DataTable();
			table.Columns.Add("col1", typeof(int));
			table.Columns.Add("col2", typeof(int));

			DataRow row = table.Rows.Add(new object[] { 1, 1 });
			table.AcceptChanges();

			row.SetModified ();
			Assert.AreEqual(row.RowState, DataRowState.Modified, "#0");
			Assert.AreEqual(1, row [0, DataRowVersion.Current], "#1");
			Assert.AreEqual(1, row [0, DataRowVersion.Original], "#2");
			table.RejectChanges ();
			Assert.AreEqual(row.RowState, DataRowState.Unchanged, "#3");
		}
开发者ID:Profit0004,项目名称:mono,代码行数:16,代码来源:DataRowTest2.cs

示例4: setAdded_testRollback

		public void setAdded_testRollback ()
		{
			DataTable table = new DataTable ();
			table.Columns.Add ("col1", typeof (int));
			table.Columns.Add ("col2", typeof (int));

			table.Rows.Add (new object[] {1,1});
			table.AcceptChanges ();

			table.Rows [0].SetAdded ();
			table.RejectChanges ();
			Assert.AreEqual (0, table.Rows.Count, "#1");
		}
开发者ID:Profit0004,项目名称:mono,代码行数:13,代码来源:DataRowTest2.cs

示例5: ActualizaBase

 private int ActualizaBase(DataTable conjuntoDeDatos)
 {
     try
     {
         if (conjuntoDeDatos == null) return -1;
         // Comprobar errores
         DataRow[] RenglonesMal = conjuntoDeDatos.GetErrors();
         // Si no hay errores se actualiza la base de
         // datos. En otro caso se avisa al usuario
         if (RenglonesMal.Length == 0)
         {
             int numeroDeRenglones = miAdaptador.Update(conjuntoDeDatos);
             conjuntoDeDatos.AcceptChanges();
             Error = "";
             misDatos = conjuntoDeDatos;
             return numeroDeRenglones;
         }
         else
         {
             Error = "";
             foreach (DataRow renglon in RenglonesMal)
             {
                 foreach (DataColumn columna in renglon.GetColumnsInError())
                 {
                     Error += renglon.GetColumnError(columna) + "\n";
                 }
             }
             conjuntoDeDatos.RejectChanges();
             misDatos = conjuntoDeDatos;
             return -1;
         }
     }
     catch (Exception ex)
     {
         Error = ex.Message;
         return -1;
     }
 }
开发者ID:pecesama,项目名称:conexionOleDb,代码行数:38,代码来源:conexionOleDb.cs

示例6: Changes

		public void Changes () //To test GetChanges and RejectChanges
		{
			DataTable table = new DataTable ();

			DataColumn col = new DataColumn ();
			col.ColumnName = "Id";
			col.DataType = typeof (int);
			table.Columns.Add (col);
			UniqueConstraint uc = new UniqueConstraint ("UK1", table.Columns[0] );
			table.Constraints.Add (uc);

			col = new DataColumn ();
			col.ColumnName = "Name";
			col.DataType = typeof (string);
			table.Columns.Add (col);

			DataRow row = table.NewRow ();
			row ["Id"] = 147;
			row ["name"] = "Abc";
			table.Rows.Add (row);
			table.AcceptChanges ();

			row = table.NewRow ();
			row ["Id"] = 47;
			row ["name"] = "Efg";
			table.Rows.Add (row);

			//Testing GetChanges
			DataTable changesTable = table.GetChanges ();
			Assert.AreEqual (1, changesTable.Rows.Count, "#A01");
 			Assert.AreEqual ("Efg", changesTable.Rows[0]["Name"], "#A02");
			table.AcceptChanges ();
			changesTable = table.GetChanges ();

			try {
				int cnt = changesTable.Rows.Count;
				Assert.Fail ();
			} catch (NullReferenceException) {
			}
			
			//Testing RejectChanges
			row = table.NewRow ();
			row ["Id"] = 247;
			row ["name"] = "Hij";
			table.Rows.Add (row);

			(table.Rows [0])["Name"] = "AaBbCc";
			table.RejectChanges ();
			Assert.AreEqual ("Abc" , (table.Rows [0]) ["Name"], "#A03");
			Assert.AreEqual (2, table.Rows.Count, "#A04");
		}
开发者ID:symform,项目名称:mono,代码行数:51,代码来源:DataTableTest.cs

示例7: GetLockRow

        private DataRow GetLockRow(DataTable tbl)
        {
            DataRow row = tbl.Rows.Find(m_Values);
            if (row == null)
            {
                try
                {
                    DataRow newrow = tbl.NewRow();
                    newrow.BeginEdit();

                    newrow["tablename"] = m_strTableName;
                    newrow["fieldnames"] = m_strKeys;
                    newrow["fieldvalues"] = m_strValues;
                    newrow["lastversion"] = 0;
                    newrow["modid"] = DBNull.Value;

                    newrow["lockip"] = DBNull.Value;
                    newrow["lockhostname"] = DBNull.Value;
                    newrow["lockusername"] = DBNull.Value;

                    newrow["locktime"] = DBNull.Value;// DateTime.MinValue;
                    newrow["unlocktime"] = DBNull.Value;//DateTime.MinValue;

                    newrow.EndEdit();
                    tbl.Rows.Add(newrow);

                    SqlCommandBuilder cmdBuilder = m_cmdBuilder;// new SqlCommandBuilder(m_adp);
                    m_adp.InsertCommand = cmdBuilder.GetInsertCommand();
                    int val = m_adp.Update(tbl);
                    tbl.AcceptChanges();
                    row = newrow;
                }
                catch (Exception ex)
                {
                    tbl.RejectChanges();
                    throw ex;
                }
            }
            return row;
        }
开发者ID:viticm,项目名称:pap2,代码行数:40,代码来源:RecordLock.cs

示例8: LoadRowTestPreserveChanges

		public void LoadRowTestPreserveChanges ()
		{
			DataTable dt = new DataTable ();
			dt.Columns.Add ("id", typeof (int));
			dt.Columns.Add ("name", typeof (string));

			dt.Rows.Add (new object [] { 1, "mono 1" });
			dt.Rows.Add (new object [] { 2, "mono 2" });
			dt.Rows.Add (new object [] { 3, "mono 3" });

			dt.PrimaryKey = new DataColumn [] { dt.Columns ["id"] };
			dt.AcceptChanges ();
			try {
				SubscribeEvents (dt);

				// current - modified; new - modified
				ResetEventFlags ();
				dt.LoadDataRow (new object [] { 2, "mono test" }, LoadOption.PreserveChanges);
				Assert.AreEqual (3, dt.Rows.Count, "#1 should not add a new row");
				Assert.AreEqual ("mono test", dt.Rows [1] [1], "#2 should change the current");
				Assert.AreEqual ("mono test", dt.Rows [1] [1, DataRowVersion.Original], "#3 should change the original");
				Assert.AreEqual (DataRowState.Unchanged, dt.Rows [1].RowState, "#4 has not changed the row state");
				Assert.IsTrue (rowChanging, "#ltpc11 row changing not called");
				Assert.AreEqual (dt.Rows [1], rowInAction_Changing, "#ltpc12 this row is not intended to change");
				Assert.AreEqual (DataRowAction.ChangeCurrentAndOriginal, rowAction_Changing, "#ltpc13 row action is not Change");
				Assert.IsTrue (rowChanged, "#ltpc14 row changed not called");
				Assert.AreEqual (dt.Rows [1], rowInAction_Changed, "#ltpc15 this row is not intended to change");
				Assert.AreEqual (DataRowAction.ChangeCurrentAndOriginal, rowAction_Changed, "#ltpc16 row action is not Change");

				// current - none; new - unchanged
				ResetEventFlags ();
				dt.LoadDataRow (new object [] { 4, "mono 4" }, LoadOption.PreserveChanges);
				Assert.AreEqual (4, dt.Rows.Count,"#5 should add a new row");
				Assert.AreEqual ("mono 4", dt.Rows [3] [1], "#6 should change the current");
				Assert.AreEqual ("mono 4", dt.Rows [3] [1, DataRowVersion.Original], "#7 should change the original");
				Assert.AreEqual (DataRowState.Unchanged, dt.Rows [3].RowState, "#8 has not changed the row state");
				Assert.IsTrue (rowChanging, "#ltpc21 row changing not called");
				Assert.AreEqual (dt.Rows [3], rowInAction_Changing, "#ltpc22 this row is not intended to change");
				Assert.AreEqual (DataRowAction.ChangeCurrentAndOriginal, rowAction_Changing, "#ltpc23 row action is not Change");
				Assert.IsTrue (rowChanged, "#ltpc24 row changed not called");
				Assert.AreEqual (dt.Rows [3], rowInAction_Changed, "#ltpc25 this row is not intended to change");
				Assert.AreEqual (DataRowAction.ChangeCurrentAndOriginal, rowAction_Changed, "#ltpc16 row action is not Change");


				dt.RejectChanges ();
                
				// current - added; new - modified
				dt.Rows.Add (new object [] { 5, "mono 5" });
				ResetEventFlags ();
				dt.LoadDataRow (new object [] { 5, "mono test" }, LoadOption.PreserveChanges);
				Assert.AreEqual (5, dt.Rows.Count, "#9 should not add a new row");
				Assert.AreEqual ("mono 5", dt.Rows [4] [1], "#10 should not change the current");
				Assert.AreEqual ("mono test", dt.Rows [4] [1, DataRowVersion.Original], "#11 should change the original");
				Assert.AreEqual (DataRowState.Modified, dt.Rows [4].RowState, "#12 has not changed the row state");
				Assert.IsTrue (rowChanging, "#ltpc31 row changing not called");
				Assert.AreEqual (dt.Rows [4], rowInAction_Changing, "#ltpc32 this row is not intended to change");
				Assert.AreEqual (DataRowAction.ChangeOriginal, rowAction_Changing, "#ltpc33 row action is not Change");
				Assert.IsTrue (rowChanged, "#ltpc34 row changed not called");
				Assert.AreEqual (dt.Rows [4], rowInAction_Changed, "#ltpc35 this row is not intended to change");
				Assert.AreEqual (DataRowAction.ChangeOriginal, rowAction_Changed, "#ltpc36 row action is not Change");


				dt.RejectChanges ();

				// current - deleted ; new - deleted ChangeOriginal
				ResetEventFlags ();
				dt.Rows [1].Delete ();
				Assert.IsTrue (rowDeleting, "#ltpc37 row deleting");
				Assert.IsTrue (rowDeleted, "#ltpc38 row deleted");
				Assert.AreEqual (rowInAction_Deleting, dt.Rows[1], "#ltpc39 rowInAction_Deleting");
				Assert.AreEqual (rowInAction_Deleted, dt.Rows[1], "#ltpc40 rowInAction_Deleted");
				Assert.AreEqual (rowAction_Deleting, DataRowAction.Delete, "#ltpc60 rowInAction_Deleting");
				Assert.AreEqual (rowAction_Deleted, DataRowAction.Delete, "#ltpc61 rowInAction_Deleted");
				dt.LoadDataRow (new object [] { 2, "mono deleted" }, LoadOption.PreserveChanges);
				Assert.AreEqual (5, dt.Rows.Count, "#13 should not add a new row");
				Assert.AreEqual ("mono deleted", dt.Rows [1] [1, DataRowVersion.Original], "#14 should change the original");
				Assert.AreEqual (DataRowState.Deleted, dt.Rows [1].RowState, "#15 has not changed the row state");
				Assert.IsTrue (rowChanging, "#ltpc41 row changing not called");
				Assert.AreEqual (dt.Rows [1], rowInAction_Changing, "#ltpc42 this row is not intended to change");
				Assert.AreEqual (DataRowAction.ChangeOriginal, rowAction_Changing, "#ltoc43 row action is not Change");
				Assert.IsTrue (rowChanged, "#ltpc44 row changed not called");
				Assert.AreEqual (dt.Rows [1], rowInAction_Changed, "#ltpc45 this row is not intended to change");
				Assert.AreEqual (DataRowAction.ChangeOriginal, rowAction_Changed, "#ltpc46 row action is not Change");


			} finally {
				UnsubscribeEvents (dt);
			}
		}
开发者ID:shana,项目名称:mono,代码行数:89,代码来源:DataTableLoadRowTest.cs

示例9: _Update

 /// <summary>
 /// private Methode zum Update der Datenbankdatei!
 /// </summary>
 /// <param name="adapter"></param>
 /// <param name="tabelle"></param>
 private void _Update(OleDbDataAdapter adapter, DataTable tabelle)
 {
     try
     {
         // Änderungen im Spiegel für die Festplattendatenbank übernehmen
         adapter.Update(tabelle);
         // Änderungen als übernommen markieren
         tabelle.AcceptChanges();
     }
     catch (Exception)
     {
         // Sollte ein Fehler auftreten, werden die Änderungen im Spiegel verworfen.
         tabelle.RejectChanges();
         throw new Exception("Änderungen an der Datenbank konnte nicht durchgeführt werden!");
     }
 }
开发者ID:julianaym,项目名称:Prog2Homework,代码行数:21,代码来源:Kundenverzeichnis.cs

示例10: LoadRowTestUpsert

                public void LoadRowTestUpsert ()
                {
                        DataTable dt = new DataTable ();
                        dt.Columns.Add ("id", typeof (int));
                        dt.Columns.Add ("name", typeof (string));

                        dt.Rows.Add (new object [] { 1, "mono 1" });
                        dt.Rows.Add (new object [] { 2, "mono 2" });
                        dt.Rows.Add (new object [] { 3, "mono 3" });

                        dt.PrimaryKey = new DataColumn [] { dt.Columns ["id"] };

                        dt.AcceptChanges ();

                        dt.LoadDataRow (new object [] { 2, "mono test" }, LoadOption.Upsert);
                        Assert.AreEqual (3, dt.Rows.Count, "#1 should not add a row");
                        Assert.AreEqual ("mono test", dt.Rows [1] [1], "#2 should change the current");
                        Assert.AreEqual ("mono 2", dt.Rows [1] [1, DataRowVersion.Original], "#3 should not change original");
                        Assert.AreEqual (DataRowState.Modified, dt.Rows [1].RowState, "#4 should change state");


                        // Row State tests
                        // current - modified ; result - modified
                        dt.LoadDataRow (new object [] { 2, "mono test 2" }, LoadOption.Upsert);
                        Assert.AreEqual ("mono test 2", dt.Rows [1] [1], "#c1 should change the current");
                        Assert.AreEqual ("mono 2", dt.Rows [1] [1, DataRowVersion.Original], "#c2 should not change original");
                        Assert.AreEqual (DataRowState.Modified, dt.Rows [1].RowState, "#c3 should not change state");

                        // current - Unchanged; result - Unchanged if no new value
                        dt.AcceptChanges ();
                        dt.LoadDataRow (new object [] { 2, "mono test 2" }, LoadOption.Upsert);
                        Assert.AreEqual ("mono test 2", dt.Rows [1] [1], "#c4 should change the current");
                        Assert.AreEqual ("mono test 2", dt.Rows [1] [1, DataRowVersion.Original], "#c5 should not change original");
                        Assert.AreEqual (DataRowState.Unchanged, dt.Rows [1].RowState, "#c6 should not change state");
                        // not the same value again
                        dt.RejectChanges ();
                        dt.LoadDataRow (new object [] { 2, "mono test 3" }, LoadOption.Upsert);
                        Assert.AreEqual (DataRowState.Modified, dt.Rows [1].RowState, "#c7 should not change state");

                        // current - added; result - added
                        dt.Rows.Add (new object [] { 4, "mono 4" });
                        dt.LoadDataRow (new object [] { 4, "mono 4" }, LoadOption.Upsert);
                        Assert.AreEqual ("mono 4", dt.Rows [3] [1], "#c8 should change the current");
                        try {
                                object o = dt.Rows [3] [1, DataRowVersion.Original];
                                Assert.Fail ("#c9 should have thrown version not found exception");
                        } catch (VersionNotFoundException) { }
                        Assert.AreEqual (DataRowState.Added, dt.Rows [3].RowState, "#c10 should not change state");

                        // current - new; result - added
                        dt.LoadDataRow (new object [] { 5, "mono 5" }, LoadOption.Upsert);
                        Assert.AreEqual ("mono 5", dt.Rows [4] [1], "#c11 should change the current");
                        try {
                                object o = dt.Rows [4] [1, DataRowVersion.Original];
                                Assert.Fail ("#c12 should have thrown version not found exception");
                        } catch (VersionNotFoundException) { }
                        Assert.AreEqual (DataRowState.Added, dt.Rows [4].RowState, "#c13 should change state");

                        // current - deleted; result - added a new row
                        dt.AcceptChanges ();
                        dt.Rows [4].Delete ();
                        dt.LoadDataRow (new object [] { 5, "mono 5" }, LoadOption.Upsert);
                        Assert.AreEqual (6, dt.Rows.Count, "#c14 should not add a row");
                        Assert.AreEqual ("mono 5", dt.Rows [5] [1], "#c15 should change the current");
                        try {
                                object o = dt.Rows [5] [1, DataRowVersion.Original];
                                Assert.Fail ("#c16 expected version not found exception ");
                        } catch (VersionNotFoundException) {}
                        Assert.AreEqual (DataRowState.Added, dt.Rows [5].RowState, "#c17 should change state");
                }
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:70,代码来源:DataTableLoadRowTest.cs

示例11: UpdateRow

        private bool UpdateRow(DataTable tbl, DataRow row, int nLastVer, DateTime dtLock, DateTime dtUnLock, bool bLock)
        {
            try
            {
                row.BeginEdit();

                row["tablename"] = m_strTableName;
                row["lastversion"] = nLastVer;

                if (bLock)
                {
                    row["lockip"] = m_strIP;
                    row["lockhostname"] = m_strHostName;
                    row["lockusername"] = m_strHostName;

                    if (dtLock == DateTime.MinValue)
                        row["locktime"] = DBNull.Value;
                    else
                        row["locktime"] = dtLock;

                    if (dtUnLock == DateTime.MinValue)
                        row["unlocktime"] = DBNull.Value;
                    else
                        row["unlocktime"] = dtUnLock;
                }
                else
                {
                    row["lockip"] = DBNull.Value;
                    row["lockhostname"] = DBNull.Value;
                    row["lockusername"] = DBNull.Value;

                    row["locktime"] = DBNull.Value;
                    if (dtUnLock == DateTime.MinValue)
                        row["unlocktime"] = DBNull.Value;
                    else
                        row["unlocktime"] = dtUnLock;
                }

                row.EndEdit();

                SqlCommandBuilder cmdBuilder = m_cmdBuilder;// new SqlCommandBuilder(m_adp);
                m_adp.UpdateCommand = cmdBuilder.GetUpdateCommand();
                int val = m_adp.Update(tbl);
                tbl.AcceptChanges();
                return val > 0;
            }
            catch (Exception ex)
            {
                tbl.RejectChanges();
                MessageBox.Show(ex.Message);
                throw ex;
            }
        }
开发者ID:viticm,项目名称:pap2,代码行数:53,代码来源:Lock.cs

示例12: UpdateRow

        private bool UpdateRow(DataTable tbl, DataRow row, int nLastVer, DateTime dtLock, DateTime dtUnLock, bool bLock)
        {
            int val = 0;

            try
            {
                if (bLock)
                {
                    row.BeginEdit();

                    row["fieldid"] = m_nFieldID;
                    row["modtabID"] = m_nModTabID;
                    row["tablename"] = m_strTableName;
                    row["fieldname"] = m_strFieldName;
                    row["lastversion"] = nLastVer;
               
                    row["lockip"] = m_strIP;
                    row["lockhostname"] = m_strHostName;
                    row["lockusername"] = m_strHostName;

                    if (dtLock == DateTime.MinValue)
                        row["locktime"] = DBNull.Value;
                    else
                        row["locktime"] = dtLock;

                    if (dtUnLock == DateTime.MinValue)
                        row["unlocktime"] = DBNull.Value;
                    else
                        row["unlocktime"] = dtUnLock;
                    row.EndEdit();
                }
                else
                {
                    row.Delete();
                }
                
                SqlCommandBuilder cmdBuilder = m_cmdBuilder;// new SqlCommandBuilder(m_adp);
                m_adp.UpdateCommand = cmdBuilder.GetUpdateCommand();
                val = m_adp.Update(tbl);

                tbl.AcceptChanges();
                return val > 0;
            }
            catch (Exception ex)
            {
                tbl.RejectChanges();
                throw ex;
            }
        }
开发者ID:viticm,项目名称:pap2,代码行数:49,代码来源:ScriptLock.cs

示例13: btn_Undo_Click

 private void btn_Undo_Click(object sender, EventArgs e)
 {
     DataTable dt = new DataTable();
     dt.RejectChanges();
 }
开发者ID:DevKoala,项目名称:Course-work,代码行数:5,代码来源:MainForm.cs

示例14: RejectChanges_CheckIndex

		public void RejectChanges_CheckIndex ()
		{
			DataTable table = new DataTable ();
			table.Columns.Add ("col1", typeof (int));
			table.PrimaryKey = new DataColumn[] {table.Columns [0]};

			table.Rows.Add (new object[] {1});
			table.AcceptChanges ();

			table.Rows [0][0] = 10;
			table.RejectChanges ();

			Assert.IsNotNull (table.Rows.Find (1));
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:14,代码来源:DataTableTest2.cs

示例15: RemoveSelectRows

            /// <summary>
            /// 条件に当てはまるレコードをDataTableから削除します。
            /// </summary>
            /// <param name="dt">データテーブル</param>
            /// <param name="filter">条件</param>
            /// <returns>0:正常終了 -1:異常終了</returns>
            public static int RemoveSelectRows(DataTable dt, string filter)
            {
                try
                {
                    DataRow[] rows = dt.Select(filter);

                    for (int i = 0; i < rows.Length; i++)
                    {
                        if (rows[i].RowState != DataRowState.Deleted)
                        {
                            rows[i].Delete();
                        }
                    }
                    dt.AcceptChanges();
                    return 0;
                }
                catch (Exception)
                {
                    dt.RejectChanges();
                    return -1;
                }
            }
开发者ID:tokunaga-nakamura,项目名称:tsssystem2,代码行数:28,代码来源:frm_seisan_koutei_m.cs


注:本文中的System.Data.DataTable.RejectChanges方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。