打印本文 打印本文 关闭窗口 关闭窗口
SqlDataAdapter中Fill方法浅析
作者:武汉SEO闵涛  文章来源:敏韬网  点击数3136  更新时间:2007/11/14 11:58:45  文章录入:mintao  责任编辑:mintao
d, int maxRecords)
{
      if (dataSet == null)
      {
            throw ADP.FillRequires("dataSet");
      }
      if (ADP.IsEmpty(srcTable))
      {
            throw ADP.FillRequiresSourceTableName("srcTable");
      }
      if (dataReader == null)
      {
            throw ADP.FillRequires("dataReader");
      }
      if (startRecord < 0)
      {
            throw ADP.InvalidStartRecord("startRecord", startRecord);
      }
      if (maxRecords < 0)
      {
            throw ADP.InvalidMaxRecords("maxRecords", maxRecords);
      }
      if (dataReader.IsClosed)
      {
            return 0;
      }
      return this.FillFromReader(dataSet, srcTable, dataReader, startRecord, maxRecords, null, null);
}
protected virtual int Fill(DataSet dataSet, int startRecord, int maxRecords, string srcTable, IDbCommand command, CommandBehavior behavior)
{
      if (dataSet == null)
      {
            throw ADP.FillRequires("dataSet");
      }
      if (command == null)
      {
            throw ADP.MissingSelectCommand("Fill");
      }
      if (startRecord < 0)
      {
            throw ADP.InvalidStartRecord("startRecord", startRecord);
      }
      if (maxRecords < 0)
      {
            throw ADP.InvalidMaxRecords("maxRecords", maxRecords);
      }
      if (ADP.IsEmpty(srcTable))
      {
            throw ADP.FillRequiresSourceTableName("srcTable");
      }
      return this.FillFromCommand(dataSet, startRecord, maxRecords, srcTable, command, behavior);
}

其实我们可以看到Fill方法调用了FillFromCommand或FillFromReader方法。这两个方法在下篇文章中在讨论。

上一页  [1] [2] [3] 

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