从数据集中选择行 [英] select rows from dataset

查看:90
本文介绍了从数据集中选择行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个数据集,我在其中填写了数据库表中的一些记录。该表包含字段(menuId,parentId,menuDsc)。现在我想根据parentId字段选择一些记录。请帮我怎样要做到这一点。



提前感谢。

I have a dataset in which i have fill some records from database table.The table contains fields (menuId,parentId,menuDsc).Now from this table i would like to select some records based on parentId field.Please help me how to do this.

thanks in advance.

推荐答案

您可以从DataTable中选择行,但是不是直接来自DataSet:

You can select rows from a DataTable, but not from a DataSet directly:
DataTable dt = (DataTable)myDataGridView.DataSource;
DataRow[] rows = dt.Select("Description LIKE '%goog%'");

由于您的DataSet由行组成,您应该能够通过DataSet.Tables集合直接处理相应的数据表。

Since your DataSet is made of of rows, you should be able to work on the appropriate datatable(s) directly via the DataSet.Tables collection.


这篇关于从数据集中选择行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆