专注收集记录技术开发学习笔记、技术难点、解决方案
网站信息搜索 >> 请输入关键词:
您当前的位置: 首页 > Delphi

DataRow数组的有关问题

发布时间:2011-06-24 19:41:57 文章来源:www.iduyao.cn 采编人员:星星草
DataRow数组的问题
prvaite DataRow[ ] rows = new DataRow [4];这个是声明的数组
需要实现功能: 读取表 PreviewFilesQueue 中Times小于3的数据。如果表中数据行为0,直接跳出,否则并以FileType 为条件,筛选出四个 DataRow[ ]数组;
已有条件:我将数据库中取出来的数据全部放到了DataTable里面, string sql = "select * from PreviewFilesQueue where Times<3";
  dt = DbHelperSQL.ExcuteTable(sql);里面有数据,我想知道如何将得到的数据通过判断FileType这个条件放到DataRow数组里面,我要的是往rows[0-3]这4个数组逐个添加条件的方法,FileType的4个条件分别为100,101,102,103.有能够解答的麻烦帮忙看下!急~~~,如果这里不方便的话,可以加我QQ,谢谢!



------解决方案--------------------
DataTable table = DataSet1.Tables["Orders"];
// Presuming the DataTable has a column named Date.
string expression;
expression = "FileType=100";
DataRow[] foundRows;

// Use the Select method to find all rows matching the filter.
foundRows = table.Select(expression);

// Print column 0 of each returned row.
for(int i = 0; i < foundRows.Length; i ++)
{
Console.WriteLine(foundRows[i][0]);
}


linq to datatable也是可以的
友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。

其他相似内容:

热门推荐: