打印本文 打印本文 关闭窗口 关闭窗口
SqlDataAdapter中Fill方法浅析
作者:武汉SEO闵涛  文章来源:敏韬网  点击数3137  更新时间:2007/11/14 11:58:45  文章录入:mintao  责任编辑:mintao

先来看看SqlDataAdapter中的所有成员
public sealed class SqlDataAdapter : DbDataAdapter, IDbDataAdapter, IDataAdapter, ICloneable
{
      // Events
      public event SqlRowUpdatedEventHandler RowUpdated;
      public event SqlRowUpdatingEventHandler RowUpdating;

      // Methods
      public SqlDataAdapter();
      public SqlDataAdapter(SqlCommand selectCommand);
      private SqlDataAdapter(SqlDataAdapter adapter);
      public SqlDataAdapter(string selectCommandText, SqlConnection selectConnection);
      public SqlDataAdapter(string selectCommandText, string selectConnectionString);
      protected override RowUpdatedEventArgs CreateRowUpdatedEvent(DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping);
      protected override RowUpdatingEventArgs CreateRowUpdatingEvent(DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping);
      protected override void Dispose(bool disposing);
      protected override void OnRowUpdated(RowUpdatedEventArgs value);
      protected override void OnRowUpdating(RowUpdatingEventArgs value);
      IDbCommand IDbDataAdapter.get_DeleteCommand();
      IDbCommand IDbDataAdapter.get_InsertCommand();
      IDbCommand IDbDataAdapter.get_SelectCommand();
      IDbCommand IDbDataAdapter.get_UpdateCommand();
      void IDbDataAdapter.set_DeleteCommand(IDbCommand value);
      void IDbDataAdapter.set_InsertCommand(IDbCommand value);
      void IDbDataAdapter.set_SelectCommand(IDbCommand value);
      void IDbDataAdapter.set_UpdateCommand(IDbCommand value);
      object ICloneable.Clone();

      // Properties
      public SqlCommand DeleteCommand { get; set; }
      public SqlCommand InsertCommand { get; set; }
      public SqlCommand SelectCommand { get; set; }
      public SqlCommand UpdateCommand { get; set; }

      // Fields
      private SqlCommand cmdDelete;
      private SqlCommand cmdInsert;
      private SqlCommand cmdSelect;
      private SqlCommand cmdUpdate;
      private SqlCommand internalCmdSelect;
}
其中并没有Fill方法,那么它从哪里来呢?想必是从它的父类DbDataAdapter中继承而来的那就
看看DbDataAdapter中的所有成员
public abstract class DbDataAdapter : DataAdapter, ICloneable
{
      // Events
      public event FillErrorEventHandler FillError;

      // Methods
      static DbDataAdapter();
      protected DbDataAdapter();
      protected DbDataAdapter(DbDataAdapter adapter);
      private static DataTable[] AddDataTableToArray(DataTable[] tables, DataTable newTable);
      private IDbCommand CloneCommand(IDbCommand command);
      protected abstract RowUpdatedEventArgs CreateRowUpdatedEvent(DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping);
      protected abstract RowUpdatingEventArgs CreateRowUpdatingEvent(DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping);
      protected override void Dispose(bool disposing);
      public override int Fill(DataSet dataSet);
      public int Fill(DataTable dataTable);
      public int Fill(DataSet dataSet, string srcTable);
      protected virtual int Fill(DataTable dataTable, IDataReader dataReader);
      protected virtual int Fill(DataTable dataTable, IDbCommand command, CommandBehavior behavior);
      public int Fill(DataSet dataSet, int startRecord, int maxRecords, string srcTable);
      protected virtual int Fill(DataSet dataSet, string srcTable, IDataReader dataReader, int startRecord, int maxRecords);
      protected virtual int Fill(DataSet dataSet, int startRecord, int maxRecords, string srcTable, IDbCommand command, CommandBehavior behavior);
      private void FillErrorHandler(Exception e, DataTable dataTable, object[] dataValues);
      private int FillFromCommand(object data, int startRecord, int maxRecords, string srcTable, IDbCommand command, CommandBehavior behavior);
      internal int FillFromReader(object data, string srcTable, IDataReader dataReader, int startRecord, int maxRecords, DataColumn parentChapterColumn, object parentChapterValue);
      private int FillLoadDataRow(SchemaMapping mapping);
      private int FillLoadDataRowChunk(SchemaMapping mapping, int startRecord, int maxRecords);
      private bool FillNextResult(IDataReader dataReader);
      public override DataTable[] FillSchema(DataSet dataSet, SchemaType schemaType);
      public DataTable FillSchema(DataTable dataTable, SchemaType schemaType);
      public DataTable[] FillSchema(DataSet dataSet, SchemaType schemaType, string srcTable);
      protected virtual DataTable FillSchema(DataTable dataTable, SchemaType schemaType, IDbCommand command, CommandBehavior behavior);
      protected virtual DataTable[] FillSchema(DataSet dataSet, SchemaType schemaType, IDbCommand command, string srcTable, CommandBehavior behavior);
      private DataTable[] FillSchemaFromCommand(object data, SchemaType schemaType, IDbCommand command, string srcTable, CommandBehavior behavior);
      private SchemaMapping FillSchemaMapping(object data, string srcTable, IDataReader dataReader, int schemaCount, DataColumn parentChapterColumn, object parentChapterValue);
      private SchemaMapping FillSchemaMappingTry(object data, string srcTable, IDataReader dataReader, int schemaCount, DataColumn parentChapterColumn, object parentChapterValue);
      private static IDbConnection GetConnection(IDbCommand command, string method);
      public override IDataParameter[] GetFillParameters();
      private static DataRowVersion GetParameterSourceVersion(StatementType typeIndex, IDataParameter parameter);
      internal static string GetSourceTableName(string srcTable, int index);
      protected virtual void OnFillError(FillErrorEventArgs value);
      protected abstract void OnRowUpdated(RowUpdatedEventArgs value);
      protected abstract void OnRowUpdating(RowUpdatingEventArgs

[1] [2] [3]  下一页

打印本文 打印本文 关闭窗口 关闭窗口