Click here to Skip to main content
16,004,540 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
can i apply select statement on table stored in data set object
Posted

Hi
Here I'm providing link for filtering data in dataset

http://howinaspnet.blogspot.in/2010/07/how-to-filter-data-in-dataset-dataview.html[^]

If you familiar with Linq just look at this
http://en.csharp-online.net/Introducing_LINQ%E2%80%94Coding_a_Simple_LINQ_to_DataSet_Query[^]


All the Best
 
Share this answer
 
Yes you can use Select on the table stored in DataSet object

First create a DataTable object and initialize it with the table from the DataSet object. DataTable class contains 4 Select methods with different parameters that returns table's rows as DataRow array :
DataTable dt=DataSet1.Tables[0];
DataRow[] rows=dt.Select("EmpId=123");

Here it will run "SELECT * FROM Employee WHERE EmpId=123" on the table and return rows with EmpId as 123

You can refer to MSDN for different Select methods :
msdn.microsoft.com/en-us/library/t5ce3dyt.aspx
 
Share this answer
 
Hi ,
You can use
C#
DataRow[] dr=  dt.Select("id =1");
//or this one
DataRow[] dr2 = ds.Tables[0].Select("id = 1");

Best Regards
M.Mitwalli
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900