Пример #1
0
        /// <see cref="NI.Data.IDalc.Update(System.Data.DataTable)"/>
        public virtual void Update(DataTable t)
        {
            var tableName = t.TableName;

            IDbDataAdapter adapter = DbFactory.CreateDataAdapter(OnRowUpdating, OnRowUpdated);

            CommandGenerator.ComposeAdapterUpdateCommands(adapter, t);

            adapter.InsertCommand.Connection = Connection;
            adapter.UpdateCommand.Connection = Connection;
            adapter.DeleteCommand.Connection = Connection;

            try {
                if (adapter is DbDataAdapter)
                {
                    ((DbDataAdapter)adapter).Update(t.DataSet, tableName);
                }
                else
                {
                    adapter.Update(t.DataSet);
                }
            } finally {
                DisposeAdapter(adapter);
            }
        }