zoukankan
html css js c++ java
将排好序的DataView转成DataTable的方法
Code
public
static
DataTable CreateTable(DataView obDataView)
{
if
(
null
==
obDataView)
{
throw
new
ArgumentNullException(
"
DataView
"
,
"
Invalid DataView object specified
"
);
}
DataTable obNewDt
=
obDataView.Table.Clone();
int
idx
=
0
;
string
[] strColNames
=
new
string
[obNewDt.Columns.Count];
foreach
(DataColumn col
in
obNewDt.Columns)
{
strColNames[idx
++
]
=
col.ColumnName;
}
IEnumerator viewEnumerator
=
obDataView.GetEnumerator();
while
(viewEnumerator.MoveNext())
{
DataRowView drv
=
(DataRowView)viewEnumerator.Current;
DataRow dr
=
obNewDt.NewRow();
try
{
foreach
(
string
strName
in
strColNames)
{
dr[strName]
=
drv[strName];
}
}
catch
(Exception ex)
{
Console.WriteLine(ex.Message);
}
obNewDt.Rows.Add(dr);
}
return
obNewDt;
}
本文来自CSDN博客,转载请标明出处:http:
//
blog.csdn.net/yaoxy/archive/2009/04/22/4099493.aspx
查看全文
相关阅读:
在mysql中,如何改变列声明.
Field 'id' doesn't have a default value 原因
secureCRT不能输入
让工程科技造福人类、创造未来—在2014年国际工程科技大会上的主旨演讲
jsp如何判断mysql数据库中是否已经存在添加的某条记录的方法
mysql alter修改字段的长度 类型sql语句
项目相关
求职信模板
PowerDesigner Constraint name uniqueness 错误
PowerDesigner 创建表格及导出SQL语句
原文地址:https://www.cnblogs.com/dfg727/p/1519101.html
最新文章
apache配置
PHP支持多线程吗?
模糊查询
火狐手机测试
H5安卓端浏览器如何去除select的边框?
enter键触发事件
js为什么放到head中有时候失效
查询今天是否签到
win7 下恢复“经典任务栏”/“快速启动栏”,关闭“窗口自动最大化” -摘自网络
Tutorial: Getting Started with SignalR (C#) -摘自网络
热门文章
Introduction to SignalR -摘自网络
SignalR Supported Platforms -摘自网络
如果iis的配置文件 applicationHost.config坏掉了, 会在 C:inetpubhistory 中存储历史备份。复制过去还原就可以了-摘自网络
使用WIF实现单点登录Part II —— Windows Identity Foundation基本原理 -摘自网络
使用WIF实现单点登录Part III —— 正式实战 -摘自网络
使用WIF实现单点登录Part I——Windows Identity Foundation介绍及环境搭建 -摘自网络
在VirtualBox中安装了Ubuntu后,Ubuntu的屏幕分辨率非常小,操作非常不便。通过安装VirtualBox提供的“增强功能组件”,-摘自网络
Win8关机 一直重启的问题 解决方案-摘自网络
myeclipse单步调试
myeclipse web servelet调试输入的中文在TOMCAT服务器的命令行显示为????
Copyright © 2011-2022 走看看