从数据集中选择行

从数据集中选择行

问题描述:

我有一个数据集,我在其中填写了数据库表中的一些记录。该表包含字段(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.