protected virtual DataAdapter CloneInternals() { DataAdapter adapter = (DataAdapter)Activator.CreateInstance(base.GetType(), BindingFlags.Public | BindingFlags.Instance, null, null, CultureInfo.InvariantCulture, null); adapter.CloneFrom(this); return(adapter); }
protected virtual DataAdapter CloneInternals() { DataAdapter clone = (DataAdapter)Activator.CreateInstance(GetType()) !; clone.CloneFrom(this); return(clone); }
protected virtual DataAdapter CloneInternals() { DataAdapter clone = (DataAdapter)Activator.CreateInstance(GetType(), System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance, null, null, CultureInfo.InvariantCulture, null); clone.CloneFrom(this); return(clone); }
protected override DbCommandBuilder CreateCommandBuilder(DataAdapter da) { if (da==null) throw new ArgumentNullException("Data Adapter argument is null"); MySqlDataAdapter msda = da as MySqlDataAdapter; if (msda == null) throw new ArgumentOutOfRangeException("da must be MySqlDataAdapter"); return new MySqlCommandBuilder(msda); }
protected DataAdapter(DataAdapter from) { this._acceptChangesDuringUpdate = true; this._acceptChangesDuringUpdateAfterInsert = true; this._acceptChangesDuringFill = true; this._missingMappingAction = System.Data.MissingMappingAction.Passthrough; this._missingSchemaAction = System.Data.MissingSchemaAction.Add; this._objectID = Interlocked.Increment(ref _objectTypeCount); this.CloneFrom(from); }
private SchemaMapping FillMappingInternal(DataSet dataset, DataTable datatable, string srcTable, DataReaderContainer dataReader, int schemaCount, DataColumn parentChapterColumn, object parentChapterValue) { bool withKeyInfo = (Data.MissingSchemaAction.AddWithKey == MissingSchemaAction); string tmp = null; if (null != dataset) { tmp = DataAdapter.GetSourceTableName(srcTable, schemaCount); } return(new SchemaMapping(this, dataset, datatable, dataReader, withKeyInfo, SchemaType.Mapped, tmp, true, parentChapterColumn, parentChapterValue)); }
public void Page_Load(Object sender, EventArgs e) { datacontrol a = (datacontrol)Session["database"]; Driver b = (Driver)Session["driver"]; System.Data.Common.DataAdapter d = a.getUseCar(b.driverid); System.Data.DataSet c = new System.Data.DataSet(); d.Fill(c); Datagride.DataSource = c; Datagride.DataBind(); }
protected DataAdapter (DataAdapter adapter) { AcceptChangesDuringFill = adapter.AcceptChangesDuringFill; ContinueUpdateOnError = adapter.ContinueUpdateOnError; MissingMappingAction = adapter.MissingMappingAction; MissingSchemaAction = adapter.MissingSchemaAction; if (adapter.tableMappings == null || adapter.TableMappings.Count <= 0) { return; } foreach (ICloneable cloneable in adapter.TableMappings) { TableMappings.Add (cloneable.Clone ()); } }
internal object FillSchemaFromReader(DataSet dataset, DataTable datatable, SchemaType schemaType, string srcTable, IDataReader dataReader) { DataTable[] dataTables = null; int schemaCount = 0; do { DataReaderContainer readerHandler = DataReaderContainer.Create(dataReader, ReturnProviderSpecificTypes); AssertReaderHandleFieldCount(readerHandler); if (0 >= readerHandler.FieldCount) { continue; } string tmp = null; if (null != dataset) { tmp = DataAdapter.GetSourceTableName(srcTable, schemaCount); schemaCount++; // don't increment if no SchemaTable ( a non-row returning result ) } SchemaMapping mapping = new SchemaMapping(this, dataset, datatable, readerHandler, true, schemaType, tmp, false, null, null); if (null != datatable) { // do not read remaining results in single DataTable case return(mapping.DataTable); } else if (null != mapping.DataTable) { if (null == dataTables) { dataTables = new DataTable[1] { mapping.DataTable }; } else { dataTables = DataAdapter.AddDataTableToArray(dataTables, mapping.DataTable); } } } while (dataReader.NextResult()); // FillSchema does not capture errors for FillError event object value = dataTables; if ((null == value) && (null == datatable)) { value = Array.Empty <DataTable>(); } return(value); // null if datatable had no results }
protected DataAdapter (DataAdapter from) { AcceptChangesDuringFill = from.AcceptChangesDuringFill; ContinueUpdateOnError = from.ContinueUpdateOnError; MissingMappingAction = from.MissingMappingAction; MissingSchemaAction = from.MissingSchemaAction; if (from.tableMappings != null) foreach (ICloneable cloneable in from.TableMappings) TableMappings.Add (cloneable.Clone ()); acceptChangesDuringUpdate = from.AcceptChangesDuringUpdate; fillLoadOption = from.FillLoadOption; returnProviderSpecificTypes = from.ReturnProviderSpecificTypes; }
/// <summary> /// 생성자 /// </summary> /// <param name="adapter">래핑될 실제 <see cref="DataAdapter"/> 인스턴스</param> public AdoDataAdapter(DataAdapter adapter) { adapter.ShouldNotBeNull("adapter"); if(IsDebugEnabled) log.Debug("AdoDataAdapter를 생성합니다... 내부적으로 System.Data.Common.DataAdapter의 protected 메소드들을 활용합니다"); DataAdapter = adapter; _doFillDataSetCommand = (FillDataSetCommand)Delegate.CreateDelegate(typeof(FillDataSetCommand), DataAdapter, "Fill"); _doFillDataTablesCommand = (FillDataTablesCommand)Delegate.CreateDelegate(typeof(FillDataTablesCommand), DataAdapter, "Fill"); _doDisposeCommand = (DisposeCommand)Delegate.CreateDelegate(typeof(DisposeCommand), DataAdapter, "Dispose"); _doFillDataSetCommand.ShouldNotBeNull("_doFillDataSetCommand"); _doFillDataTablesCommand.ShouldNotBeNull("_doFillDataTablesCommand"); }
/// <include file='doc\DataAdapter.uex' path='docs/doc[@for="DataAdapter.DataAdapter1"]/*' /> protected DataAdapter(DataAdapter adapter) : base() // MDAC 81448 { AcceptChangesDuringFill = adapter.AcceptChangesDuringFill; ContinueUpdateOnError = adapter.ContinueUpdateOnError; MissingMappingAction = adapter.MissingMappingAction; MissingSchemaAction = adapter.MissingSchemaAction; if ((null != adapter.tableMappings) && (0 < adapter.TableMappings.Count)) { DataTableMappingCollection parameters = this.TableMappings; foreach (ICloneable parameter in adapter.TableMappings) { parameters.Add(parameter.Clone()); } } }
protected DataAdapter (DataAdapter adapter) { AcceptChangesDuringFill = adapter.AcceptChangesDuringFill; ContinueUpdateOnError = adapter.ContinueUpdateOnError; MissingMappingAction = adapter.MissingMappingAction; MissingSchemaAction = adapter.MissingSchemaAction; if (adapter.tableMappings != null) foreach (ICloneable cloneable in adapter.TableMappings) TableMappings.Add (cloneable.Clone ()); #if NET_2_0 acceptChangesDuringUpdate = adapter.AcceptChangesDuringUpdate; fillLoadOption = adapter.FillLoadOption; returnProviderSpecificTypes = adapter.ReturnProviderSpecificTypes; #endif }
public DataSet GetDataSet(DataAdapter adapter) { int RowCount = 0; DataSet ds = new DataSet(); try { RowCount = adapter.Fill(ds); } catch (Exception e) { Exceptions.LogOnly(e); RowCount = 0; ds.ExtendedProperties["error"] = e; } return ds; }
public void Page_Load(Object sender, EventArgs e) { datacontrol a = (datacontrol)Session["database"]; System.Data.Common.DataAdapter d = a.getAContract(); System.Data.DataSet c = new System.Data.DataSet(); try { d.Fill(c); AlGride.DataSource = c; AlGride.DataBind(); } catch (System.Data.SQLite.SQLiteException) { Response.Write("<script>alert('没有待同意合同');</script>"); } }
protected DataAdapter(DataAdapter from) { AcceptChangesDuringFill = from.AcceptChangesDuringFill; ContinueUpdateOnError = from.ContinueUpdateOnError; MissingMappingAction = from.MissingMappingAction; MissingSchemaAction = from.MissingSchemaAction; if (from.tableMappings != null) { foreach (ICloneable cloneable in from.TableMappings) { TableMappings.Add(cloneable.Clone()); } } acceptChangesDuringUpdate = from.AcceptChangesDuringUpdate; fillLoadOption = from.FillLoadOption; returnProviderSpecificTypes = from.ReturnProviderSpecificTypes; }
private void CloneFrom(DataAdapter from) { this._acceptChangesDuringUpdate = from._acceptChangesDuringUpdate; this._acceptChangesDuringUpdateAfterInsert = from._acceptChangesDuringUpdateAfterInsert; this._continueUpdateOnError = from._continueUpdateOnError; this._returnProviderSpecificTypes = from._returnProviderSpecificTypes; this._acceptChangesDuringFill = from._acceptChangesDuringFill; this._fillLoadOption = from._fillLoadOption; this._missingMappingAction = from._missingMappingAction; this._missingSchemaAction = from._missingSchemaAction; if ((from._tableMappings != null) && (0 < from.TableMappings.Count)) { DataTableMappingCollection tableMappings = this.TableMappings; foreach (object obj2 in from.TableMappings) { tableMappings.Add((obj2 is ICloneable) ? ((ICloneable) obj2).Clone() : obj2); } } }
[System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand, Name = "FullTrust")] // MDAC 82936 virtual protected DataAdapter CloneInternals() { DataAdapter clone = (DataAdapter)Activator.CreateInstance(GetType()); clone.AcceptChangesDuringFill = AcceptChangesDuringFill; clone.ContinueUpdateOnError = ContinueUpdateOnError; clone.MissingMappingAction = MissingMappingAction; clone.MissingSchemaAction = MissingSchemaAction; if ((null != this.tableMappings) && (0 < TableMappings.Count)) { DataTableMappingCollection parameters = clone.TableMappings; foreach (ICloneable parameter in TableMappings) { parameters.Add(parameter.Clone()); } } return(clone); }
private void CloneFrom(DataAdapter from) { this._acceptChangesDuringUpdate = from._acceptChangesDuringUpdate; this._acceptChangesDuringUpdateAfterInsert = from._acceptChangesDuringUpdateAfterInsert; this._continueUpdateOnError = from._continueUpdateOnError; this._returnProviderSpecificTypes = from._returnProviderSpecificTypes; this._acceptChangesDuringFill = from._acceptChangesDuringFill; this._fillLoadOption = from._fillLoadOption; this._missingMappingAction = from._missingMappingAction; this._missingSchemaAction = from._missingSchemaAction; if ((from._tableMappings != null) && (0 < from.TableMappings.Count)) { DataTableMappingCollection tableMappings = this.TableMappings; foreach (object obj2 in from.TableMappings) { tableMappings.Add((obj2 is ICloneable) ? ((ICloneable)obj2).Clone() : obj2); } } }
protected DataAdapter(DataAdapter adapter) { AcceptChangesDuringFill = adapter.AcceptChangesDuringFill; ContinueUpdateOnError = adapter.ContinueUpdateOnError; MissingMappingAction = adapter.MissingMappingAction; MissingSchemaAction = adapter.MissingSchemaAction; if (adapter.tableMappings != null) { foreach (ICloneable cloneable in adapter.TableMappings) { TableMappings.Add(cloneable.Clone()); } } #if NET_2_0 acceptChangesDuringUpdate = adapter.AcceptChangesDuringUpdate; fillLoadOption = adapter.FillLoadOption; returnProviderSpecificTypes = adapter.ReturnProviderSpecificTypes; #endif }
private void CloneFrom(DataAdapter from) { _acceptChangesDuringUpdate = from._acceptChangesDuringUpdate; _acceptChangesDuringUpdateAfterInsert = from._acceptChangesDuringUpdateAfterInsert; _continueUpdateOnError = from._continueUpdateOnError; _returnProviderSpecificTypes = from._returnProviderSpecificTypes; _acceptChangesDuringFill = from._acceptChangesDuringFill; _fillLoadOption = from._fillLoadOption; _missingMappingAction = from._missingMappingAction; _missingSchemaAction = from._missingSchemaAction; if ((null != from._tableMappings) && (0 < from.TableMappings.Count)) { DataTableMappingCollection parameters = TableMappings; foreach (object parameter in from.TableMappings) { parameters.Add((parameter is ICloneable) ? ((ICloneable)parameter).Clone() : parameter); } } }
internal SchemaMapping(DataAdapter adapter, DataSet dataset, DataTable datatable, DataReaderContainer dataReader, bool keyInfo, SchemaType schemaType, string sourceTableName, bool gettingData, DataColumn parentChapterColumn, object parentChapterValue) { Debug.Assert(null != adapter, "adapter"); Debug.Assert(null != dataReader, "dataReader"); Debug.Assert(0 < dataReader.FieldCount, "FieldCount"); Debug.Assert(null != dataset || null != datatable, "SchemaMapping - null dataSet"); Debug.Assert(SchemaType.Mapped == schemaType || SchemaType.Source == schemaType, "SetupSchema - invalid schemaType"); _dataSet = dataset; // setting DataSet implies chapters are supported _dataTable = datatable; // setting only DataTable, not DataSet implies chapters are not supported _adapter = adapter; _dataReader = dataReader; if (keyInfo) { _schemaTable = dataReader.GetSchemaTable(); } if (adapter.ShouldSerializeFillLoadOption()) { _loadOption = adapter.FillLoadOption; } else if (adapter.AcceptChangesDuringFill) { _loadOption = (LoadOption)4; // true } else { _loadOption = (LoadOption)5; //false } MissingMappingAction mappingAction; MissingSchemaAction schemaAction; if (SchemaType.Mapped == schemaType) { mappingAction = _adapter.MissingMappingAction; schemaAction = _adapter.MissingSchemaAction; if (!ADP.IsEmpty(sourceTableName)) { // MDAC 66034 _tableMapping = _adapter.GetTableMappingBySchemaAction(sourceTableName, sourceTableName, mappingAction); } else if (null != _dataTable) { int index = _adapter.IndexOfDataSetTable(_dataTable.TableName); if (-1 != index) { _tableMapping = _adapter.TableMappings[index]; } else { switch (mappingAction) { case MissingMappingAction.Passthrough: _tableMapping = new DataTableMapping(_dataTable.TableName, _dataTable.TableName); break; case MissingMappingAction.Ignore: _tableMapping = null; break; case MissingMappingAction.Error: throw ADP.MissingTableMappingDestination(_dataTable.TableName); default: throw ADP.InvalidMissingMappingAction(mappingAction); } } } } else if (SchemaType.Source == schemaType) { mappingAction = System.Data.MissingMappingAction.Passthrough; schemaAction = Data.MissingSchemaAction.Add; if (!ADP.IsEmpty(sourceTableName)) { // MDAC 66034 _tableMapping = DataTableMappingCollection.GetTableMappingBySchemaAction(null, sourceTableName, sourceTableName, mappingAction); } else if (null != _dataTable) { int index = _adapter.IndexOfDataSetTable(_dataTable.TableName); // MDAC 66034 if (-1 != index) { _tableMapping = _adapter.TableMappings[index]; } else { _tableMapping = new DataTableMapping(_dataTable.TableName, _dataTable.TableName); } } } else { throw ADP.InvalidSchemaType(schemaType); } if (null != _tableMapping) { if (null == _dataTable) { _dataTable = _tableMapping.GetDataTableBySchemaAction(_dataSet, schemaAction); } if (null != _dataTable) { _fieldNames = GenerateFieldNames(dataReader); if (null == _schemaTable) { _readerDataValues = SetupSchemaWithoutKeyInfo(mappingAction, schemaAction, gettingData, parentChapterColumn, parentChapterValue); } else { _readerDataValues = SetupSchemaWithKeyInfo(mappingAction, schemaAction, gettingData, parentChapterColumn, parentChapterValue); } } // else (null == _dataTable) which means ignore (mapped to nothing) } }
internal SchemaMapping(DataAdapter adapter, DataSet dataset, System.Data.DataTable datatable, DataReaderContainer dataReader, bool keyInfo, SchemaType schemaType, string sourceTableName, bool gettingData, DataColumn parentChapterColumn, object parentChapterValue) { MissingMappingAction missingMappingAction; MissingSchemaAction missingSchemaAction; this._dataSet = dataset; this._dataTable = datatable; this._adapter = adapter; this._dataReader = dataReader; if (keyInfo) { this._schemaTable = dataReader.GetSchemaTable(); } if (adapter.ShouldSerializeFillLoadOption()) { this._loadOption = adapter.FillLoadOption; } else if (adapter.AcceptChangesDuringFill) { this._loadOption = (LoadOption) 4; } else { this._loadOption = (LoadOption) 5; } if (SchemaType.Mapped == schemaType) { missingMappingAction = this._adapter.MissingMappingAction; missingSchemaAction = this._adapter.MissingSchemaAction; if (ADP.IsEmpty(sourceTableName)) { if (this._dataTable != null) { int num2 = this._adapter.IndexOfDataSetTable(this._dataTable.TableName); if (-1 == num2) { switch (missingMappingAction) { case MissingMappingAction.Passthrough: this._tableMapping = new DataTableMapping(this._dataTable.TableName, this._dataTable.TableName); goto Label_01DB; case MissingMappingAction.Ignore: this._tableMapping = null; goto Label_01DB; case MissingMappingAction.Error: throw ADP.MissingTableMappingDestination(this._dataTable.TableName); } throw ADP.InvalidMissingMappingAction(missingMappingAction); } this._tableMapping = this._adapter.TableMappings[num2]; } } else { this._tableMapping = this._adapter.GetTableMappingBySchemaAction(sourceTableName, sourceTableName, missingMappingAction); } } else { if (SchemaType.Source != schemaType) { throw ADP.InvalidSchemaType(schemaType); } missingMappingAction = MissingMappingAction.Passthrough; missingSchemaAction = MissingSchemaAction.Add; if (!ADP.IsEmpty(sourceTableName)) { this._tableMapping = DataTableMappingCollection.GetTableMappingBySchemaAction(null, sourceTableName, sourceTableName, missingMappingAction); } else if (this._dataTable != null) { int num = this._adapter.IndexOfDataSetTable(this._dataTable.TableName); if (-1 != num) { this._tableMapping = this._adapter.TableMappings[num]; } else { this._tableMapping = new DataTableMapping(this._dataTable.TableName, this._dataTable.TableName); } } } Label_01DB: if (this._tableMapping != null) { if (this._dataTable == null) { this._dataTable = this._tableMapping.GetDataTableBySchemaAction(this._dataSet, missingSchemaAction); } if (this._dataTable != null) { this._fieldNames = GenerateFieldNames(dataReader); if (this._schemaTable == null) { this._readerDataValues = this.SetupSchemaWithoutKeyInfo(missingMappingAction, missingSchemaAction, gettingData, parentChapterColumn, parentChapterValue); return; } this._readerDataValues = this.SetupSchemaWithKeyInfo(missingMappingAction, missingSchemaAction, gettingData, parentChapterColumn, parentChapterValue); } } }
protected DataAdapter(DataAdapter from) : base() { CloneFrom(from); }
protected override DbCommandBuilder CreateCommandBuilder(DataAdapter da) { if (da == null) throw new ArgumentNullException("da"); OdbcDataAdapter oda = da as OdbcDataAdapter; if (oda == null) throw new ArgumentOutOfRangeException("da must be OdbcDataAdapter"); return new OdbcCommandBuilder(oda); }
protected DataAdapter(DataAdapter from) : base() { // V1.1.3300 CloneFrom(from); }
private void CloneFrom(DataAdapter from) { _acceptChangesDuringUpdate = from._acceptChangesDuringUpdate; _acceptChangesDuringUpdateAfterInsert = from._acceptChangesDuringUpdateAfterInsert; _continueUpdateOnError = from._continueUpdateOnError; _returnProviderSpecificTypes = from._returnProviderSpecificTypes; // WebData 101795 _acceptChangesDuringFill = from._acceptChangesDuringFill; _fillLoadOption = from._fillLoadOption; _missingMappingAction = from._missingMappingAction; _missingSchemaAction = from._missingSchemaAction; if ((null != from._tableMappings) && (0 < from.TableMappings.Count)) { DataTableMappingCollection parameters = this.TableMappings; foreach(object parameter in from.TableMappings) { parameters.Add((parameter is ICloneable) ? ((ICloneable)parameter).Clone() : parameter); } } }
protected DataAdapter(DataAdapter from) : base() // V1.1.3300 { CloneFrom(from); }
protected abstract DbCommandBuilder CreateCommandBuilder(DataAdapter da);