|
|
 |
专题栏目 |
 |
 |
相关文章 |
 |
|
|
|
|
 |
SqlDataAdapter中的Fill方法(2) |
热 |
|
| SqlDataAdapter中的Fill方法(2) |
|
作者:thinkingforever 文章来源:不详 点击数: 更新时间:2007-11-14 12:03:51  |
|
nbsp; { return; } } if (this.schemaTable == null) { this.SetupSchemaWithoutKeyInfo(action1, action2, gettingData, parentChapterColumn, parentChapterValue); } else { this.SetupSchemaWithKeyInfo(action1, action2, gettingData, parentChapterColumn, parentChapterValue); } } } //FillLoadDataRowChunk private int FillLoadDataRowChunk(SchemaMapping mapping, int startRecord, int maxRecords) { IDataReader reader1 = mapping.DataReader; while (0 < startRecord) //把DataReader调整到读startRecord记录的位置 { //如果DataReader的总的记录数小于startRecord,就返回0 if (!reader1.Read()) //其实在这里也可以看出要在DataReader中定位,只有去边历DataReader { //到这里我们也可以明白fill方法其实也是用DataReader一条条读出来的 return 0; } startRecord--; } int num1 = 0; if (0 >= maxRecords) { goto Label_0062; } bool flag1 = base.AcceptChangesDuringFill;//指示在Fill操作过程中,在将 AcceptChanges 添加到 DataTable 之后是否针对 DataRow 调用它。可以在msdn中的DataAdapter 类中查看 goto Label_0054; Label_002B: try { mapping.LoadDataRow(this.hasFillErrorHandler, flag1);//装载数据 num1++; } catch (Exception exception1) { this.FillErrorHandler(exception1, mapping.DataTable, mapping.DataValues); } Label_0054: if (num1 >= maxRecords)//如果载入的记录数已经满足条件,就退出,否则继续 { goto Label_006A; } if (reader1.Read())//继续读取数据 { goto Label_002B; } goto Label_006A; Label_0062: num1 = this.FillLoadDataRow(mapping); Label_006A: return num1; } 到这里fill方法大概就完了,其实看来fill方法就是首先创建映射,然后在用datareader把数据填充进来.其中我忽略了好多东西比如它的异常处理,还有好多细节,请各位朋友多多指教,在这里列出来也是和各位朋友探讨。
上一页 [1] [2] [3] [4] |
|
| 文章录入:mintao 责任编辑:mintao |
|
|
上一篇文章: FreeBSD下安装PostgreSQL新手教程 下一篇文章: sql server 存储过程分页(原创) |
|
|
| 【字体:小 大】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口】 |
|
注:本站部分文章源于互联网,版权归原作者所有!如有侵权,请原作者与本站联系,本站将立即删除! 本站文章除特别注明外均可转载,但需注明出处! [MinTao学以致用网] |
网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!) |
| |
|
|
|
|