`
yzd
  • 浏览: 1818000 次
  • 性别: Icon_minigender_2
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论

为数据表添加汇总数据方法

 
阅读更多
<div style="">
<div>
<img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""><span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">private</span><span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);">MakeTable(DataTabledt)<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif" id="_48_1086_Open_Image" alt=""><img align="top" style="display: none;" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif" id="_48_1086_Closed_Image" alt=""></span><span style="border: 1px solid rgb(128, 128, 128); background-color: rgb(255, 255, 255); display: none;" id="_48_1086_Closed_Text">...</span><span id="_48_1086_Open_Text"><span style="color: rgb(0, 0, 0);">{<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">dt.Columns.Add(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">总计</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">DataRowdrNewRow</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">dt.NewRow();<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt=""></span><span style="color: rgb(0, 0, 255);">foreach</span><span style="color: rgb(0, 0, 0);">(DataColumndc</span><span style="color: rgb(0, 0, 255);">in</span><span style="color: rgb(0, 0, 0);">dt.Columns)<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">drNewRow[dc]</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">;<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">drNewRow[</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">]</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">总计</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">;<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt=""></span><span style="color: rgb(0, 0, 255);">double</span><span style="color: rgb(0, 0, 0);">temp</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">;<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt=""></span><span style="color: rgb(0, 0, 255);">foreach</span><span style="color: rgb(0, 0, 0);">(DataRowdr</span><span style="color: rgb(0, 0, 255);">in</span><span style="color: rgb(0, 0, 0);">dt.Rows)<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif" id="_329_1041_Open_Image" alt=""><img align="top" style="display: none;" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif" id="_329_1041_Closed_Image" alt=""></span><span style="border: 1px solid rgb(128, 128, 128); background-color: rgb(255, 255, 255); display: none;" id="_329_1041_Closed_Text">...</span><span id="_329_1041_Open_Text"><span style="color: rgb(0, 0, 0);">{<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt=""></span><span style="color: rgb(0, 0, 255);">double</span><span style="color: rgb(0, 0, 0);">d</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">;<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt=""></span><span style="color: rgb(0, 0, 255);">foreach</span><span style="color: rgb(0, 0, 0);">(DataColumndc</span><span style="color: rgb(0, 0, 255);">in</span><span style="color: rgb(0, 0, 0);">dt.Columns)<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif" id="_431_919_Open_Image" alt=""><img align="top" style="display: none;" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif" id="_431_919_Closed_Image" alt=""></span><span style="border: 1px solid rgb(128, 128, 128); background-color: rgb(255, 255, 255); display: none;" id="_431_919_Closed_Text">...</span><span id="_431_919_Open_Text"><span style="color: rgb(0, 0, 0);">{<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt=""></span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">(dt.Columns.IndexOf(dc)</span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 0);">||</span><span style="color: rgb(0, 0, 0);">dc.ColumnName</span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">总计</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">)<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt=""></span><span style="color: rgb(0, 0, 255);">continue</span><span style="color: rgb(0, 0, 0);">;<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt=""></span><span style="color: rgb(0, 0, 255);">try</span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif" id="_589_766_Open_Image" alt=""><img align="top" style="display: none;" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif" id="_589_766_Closed_Image" alt=""></span><span style="border: 1px solid rgb(128, 128, 128); background-color: rgb(255, 255, 255); display: none;" id="_589_766_Closed_Text">...</span><span id="_589_766_Open_Text"><span style="color: rgb(0, 0, 0);">{<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt=""></span><span style="color: rgb(0, 0, 255);">double</span><span style="color: rgb(0, 0, 0);">.TryParse(dr[dc].ToString(),</span><span style="color: rgb(0, 0, 255);">out</span><span style="color: rgb(0, 0, 0);">temp);<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">drNewRow[dc]</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">temp</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">double</span><span style="color: rgb(0, 0, 0);">.Parse(drNewRow[dc].ToString());<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif" alt="">}</span></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt=""></span><span style="color: rgb(0, 0, 255);">catch</span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif" id="_814_870_Open_Image" alt=""><img align="top" style="display: none;" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif" id="_814_870_Closed_Image" alt=""></span><span style="border: 1px solid rgb(128, 128, 128); background-color: rgb(255, 255, 255); display: none;" id="_814_870_Closed_Text">...</span><span id="_814_870_Open_Text"><span style="color: rgb(0, 0, 0);">{<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">temp</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">;<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif" alt="">}</span></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">d</span><span style="color: rgb(0, 0, 0);">+=</span><span style="color: rgb(0, 0, 0);">temp;<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif" alt="">}</span></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">dr[</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">总计</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">]</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">d;<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">drNewRow[</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">总计</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">]</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">d</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">double</span><span style="color: rgb(0, 0, 0);">.Parse(drNewRow[</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">总计</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">].ToString());<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif" alt="">}</span></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">dt.Rows.Add(drNewRow);<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif" alt="">}</span></span>
</div>
</div>
分享到:
评论

相关推荐

    Excel 2007数据透视表完全剖析 1/7

    11.8 使用分组汇总数据字段 247 11.9 使用高级数据透视表技术 251 11.9.1 使用AutoShow生成执行概要 251 11.9.2 使用ShowDetail过滤记录集 254 11.9.3 为每个区域或模型创建报表 256 11.9.4 手动筛选数据...

    kettle全量多表数据同步

    XXXKETTLE全量多表数据同步 1 一. 建立资料库 3 1.1 添加资源库 3 二. 前期准备工作 7 2.1 异结构数据传输 7 2.2 数据校验 9 三. 建立转换 10 3.1 创建‘转换’(GET—ORACLE-TABLES) 10 3.1.1 创建数据源 10 3.1.2...

    Excel 2007数据透视表完全剖析 3/7

    11.8 使用分组汇总数据字段 247 11.9 使用高级数据透视表技术 251 11.9.1 使用AutoShow生成执行概要 251 11.9.2 使用ShowDetail过滤记录集 254 11.9.3 为每个区域或模型创建报表 256 11.9.4 手动筛选数据...

    Excel 2007数据透视表完全剖析 5/7

    11.8 使用分组汇总数据字段 247 11.9 使用高级数据透视表技术 251 11.9.1 使用AutoShow生成执行概要 251 11.9.2 使用ShowDetail过滤记录集 254 11.9.3 为每个区域或模型创建报表 256 11.9.4 手动筛选数据...

    Excel 2007数据透视表完全剖析 4/7

    11.8 使用分组汇总数据字段 247 11.9 使用高级数据透视表技术 251 11.9.1 使用AutoShow生成执行概要 251 11.9.2 使用ShowDetail过滤记录集 254 11.9.3 为每个区域或模型创建报表 256 11.9.4 手动筛选数据...

    Excel数据透视表应用大全示例文件(共18章).rar

    2快速设置数据透视表的分类汇总格式.xls4.1.6-3在数据透视表中快速选取同类数据.xls4.1.7修改数据透视表中数值型数据的格式.xls4.1.8-1替换行字段中包含“(空白)”字样的数据项.xls4.1.8-2填充列字段空白数据项...

    C#使用DropDownList绑定添加新数据的方法汇总

    主要介绍了C#使用DropDownList绑定添加新数据的方法汇总的相关资料,需要的朋友可以参考下

    2021数据仓库服务常见问题汇总-华为-51页.pdf

    1.3 为什么要使用数据仓库? 1.4 数据仓库适合哪些场合使用? 1.5 数据仓库和Hadoop 大数据平台有什么差别? 1.6 为什么要使用公有云数据仓库服务GaussDB(DWS) ? 1.7 数据仓库服务的优势有哪些? 1.8 如何选择公有...

    数据集分析汇总,文本到图像的 AI 模型

    本篇将简述文本生成图像的数据集,汇总介绍数据集的内容、特点、细节和下载方式等。 一、Caltech-UCSD Bird(CUB-200-2011) 1.1、介绍 CUB-200-2011数据集是CUB-200-2011是CUB-200的扩展版本,这是一个具有挑战性的...

    数据分析.pptx

    除了为数据添加文字说明还需说什么? 数据分析的目的达到了吗? 数据分析报告要写多少页? 数据分析报告有说服力吗? …… …… A、数据分析哪些事儿 他们主要的 区别就在于 目的是否明确 数据分析全文共58页,当前...

    ACCESS911科目汇总表

    --------------------------------------------------------------&lt;BR&gt;&lt;BR&gt;20001207&lt;BR&gt;&lt;BR&gt;最新制作计划:将更新科目汇总表,添加登陆界面、多用户密码验证(简单加密)、考虑多用户同时操作(现不考虑NT下数据传输...

    数据分析怎么做.pptx

    除了为数据添加文字说明还需说什么? 数据分析的目的达到了吗? 数据分析报告要写多少页? 数据分析报告有说服力吗? …… …… A、数据分析哪些事儿 他们主要的 区别就在于 目的是否明确 数据分析怎么做全文共56页...

    如何做数据分析.pptx

    除了为数据添加文字说明还需说什么? 数据分析的目的达到了吗? 数据分析报告要写多少页? 数据分析报告有说服力吗? …… …… 他们主要的 区别就在于 目的是否明确 6/50 如何做数据分析全文共50页,当前为第6页。...

    Python之数据处理案例

    (1)将数据表添加两列:每位同学的各科成绩总分(score)和每位同学的整体情况(类别),类别按照[df.score.min()-1,400,450,df.score.max()+1]分为“一般” “较好” “优秀”三种情况。 (2)由于“军训 ”这门课...

    全球人口格点数据 数据集 TIF(LandScan,2010)【500010022】

    ● 数据修订(Data Revisions):数据库每年更新升级,将全新的空间数据和影像分析数据添加至分布式算法中应用。不同版本间的数据集可能会产生不一样的结果。LandScan数据集各种版本之间的差异是由于城市的不断发展...

    NC6多子表表头表体合计.docx

    NC65支持多子表开发及在表头和表体增加合计,包含xml配置方法

    mjeppesen/matlab-pivot-table:数据透视表:使用表格数据对象的 matlab 数据透视表-matlab开发

    事实上,如果将内置数据透视表函数添加到未来的 Matlab 版本中,我不会感到惊讶,在这种情况下,本文档很容易过时并且不再需要 pivot_table 函数。 Matlab 文件交换中存在其他数据透视表函数,例如 pivottable 和 ...

    全球人口格点数据 数据集 TIF(LandScan,2020)【500010022】

    ● 数据修订(Data Revisions):数据库每年更新升级,将全新的空间数据和影像分析数据添加至分布式算法中应用。不同版本间的数据集可能会产生不一样的结果。LandScan数据集各种版本之间的差异是由于城市的不断发展...

    全球人口格点数据 数据集 TIF(LandScan,2017)【500010022】

    ● 数据修订(Data Revisions):数据库每年更新升级,将全新的空间数据和影像分析数据添加至分布式算法中应用。不同版本间的数据集可能会产生不一样的结果。LandScan数据集各种版本之间的差异是由于城市的不断发展...

Global site tag (gtag.js) - Google Analytics