public void WriteToServer(DataRow[] rows)
        {
            SqlConnection.ExecutePermission.Demand();
            SqlStatistics statistics = this.Statistics;

            try
            {
                statistics = SqlStatistics.StartTimer(this.Statistics);
                if (rows == null)
                {
                    throw new ArgumentNullException("rows");
                }
                if (rows.Length != 0)
                {
                    DataTable table = rows[0].Table;
                    this._rowState  = 0;
                    this._rowSource = rows;
                    this._SqlDataReaderRowSource = null;
                    this._rowSourceType          = ValueSourceType.RowArray;
                    this._rowEnumerator          = rows.GetEnumerator();
                    this.WriteRowSourceToServer(table.Columns.Count);
                }
            }
            finally
            {
                SqlStatistics.StopTimer(statistics);
            }
        }
        public void WriteToServer(IDataReader reader)
        {
            SqlConnection.ExecutePermission.Demand();
            SqlStatistics statistics = this.Statistics;

            try
            {
                statistics = SqlStatistics.StartTimer(this.Statistics);
                if (reader == null)
                {
                    throw new ArgumentNullException("reader");
                }
                this._rowSource = reader;
                this._SqlDataReaderRowSource = this._rowSource as SqlDataReader;
                this._rowSourceType          = ValueSourceType.IDataReader;
                this.WriteRowSourceToServer(reader.FieldCount);
            }
            finally
            {
                SqlStatistics.StopTimer(statistics);
            }
        }
        public void WriteToServer(DataTable table, DataRowState rowState)
        {
            SqlConnection.ExecutePermission.Demand();
            SqlStatistics statistics = this.Statistics;

            try
            {
                statistics = SqlStatistics.StartTimer(this.Statistics);
                if (table == null)
                {
                    throw new ArgumentNullException("table");
                }
                this._rowState  = rowState & ~DataRowState.Deleted;
                this._rowSource = table;
                this._SqlDataReaderRowSource = null;
                this._rowSourceType          = ValueSourceType.DataTable;
                this._rowEnumerator          = table.Rows.GetEnumerator();
                this.WriteRowSourceToServer(table.Columns.Count);
            }
            finally
            {
                SqlStatistics.StopTimer(statistics);
            }
        }
 public void WriteToServer(DataTable table, DataRowState rowState)
 {
     SqlConnection.ExecutePermission.Demand();
     SqlStatistics statistics = this.Statistics;
     try
     {
         statistics = SqlStatistics.StartTimer(this.Statistics);
         if (table == null)
         {
             throw new ArgumentNullException("table");
         }
         this._rowState = rowState & ~DataRowState.Deleted;
         this._rowSource = table;
         this._SqlDataReaderRowSource = null;
         this._rowSourceType = ValueSourceType.DataTable;
         this._rowEnumerator = table.Rows.GetEnumerator();
         this.WriteRowSourceToServer(table.Columns.Count);
     }
     finally
     {
         SqlStatistics.StopTimer(statistics);
     }
 }
 public void WriteToServer(DataRow[] rows)
 {
     SqlConnection.ExecutePermission.Demand();
     SqlStatistics statistics = this.Statistics;
     try
     {
         statistics = SqlStatistics.StartTimer(this.Statistics);
         if (rows == null)
         {
             throw new ArgumentNullException("rows");
         }
         if (rows.Length != 0)
         {
             DataTable table = rows[0].Table;
             this._rowState = 0;
             this._rowSource = rows;
             this._SqlDataReaderRowSource = null;
             this._rowSourceType = ValueSourceType.RowArray;
             this._rowEnumerator = rows.GetEnumerator();
             this.WriteRowSourceToServer(table.Columns.Count);
         }
     }
     finally
     {
         SqlStatistics.StopTimer(statistics);
     }
 }
 public void WriteToServer(IDataReader reader)
 {
     SqlConnection.ExecutePermission.Demand();
     SqlStatistics statistics = this.Statistics;
     try
     {
         statistics = SqlStatistics.StartTimer(this.Statistics);
         if (reader == null)
         {
             throw new ArgumentNullException("reader");
         }
         this._rowSource = reader;
         this._SqlDataReaderRowSource = this._rowSource as SqlDataReader;
         this._rowSourceType = ValueSourceType.IDataReader;
         this.WriteRowSourceToServer(reader.FieldCount);
     }
     finally
     {
         SqlStatistics.StopTimer(statistics);
     }
 }