从数据集中删除空行(不可数据) [英] Remove empty rows from Dataset(Not Datatable)
本文介绍了从数据集中删除空行(不可数据)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
HI,
我正在使用VS 2012,C#和ASP.NET
我有一个数据集,我试图删除空行。
如何实现这个目标?
解决方案
< blockquote>试试这个.. :)
DataSet ds = new 数据集();
for ( int i = 0 ; i < ds.Tables.Count; i ++)
{
for ( int j = 0 ; j < ds.Tables [i] .Rows.Count; j ++)
{
if (Convert.ToString(ds) .Tables [i] .Rows [j] [ ColumnName])== string .Empty)
{
ds.Tables [i] .Rows [j] .Delete();
}
}
}
i已创建此片段而未对其进行测试,因此请根据需要进行修改。
HI,
I am using VS 2012, C# and ASP.NET
I have a Dataset, in which I am trying to delete the empty rows.
How to achieve this?
解决方案
try this.. :)
DataSet ds = new DataSet(); for (int i = 0; i < ds.Tables.Count; i++) { for (int j = 0; j < ds.Tables[i].Rows.Count; j++) { if (Convert.ToString(ds.Tables[i].Rows[j]["ColumnName"]) == string.Empty) { ds.Tables[i].Rows[j].Delete(); } } }
i have created this snippet without testing of it, so modify it according to your need.
这篇关于从数据集中删除空行(不可数据)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文