Hi,
How to filter in dataset any one name is like a name "Raja" in the dataset
how to filter?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Satyapriya NayakPosted Oct 23, 2012, 2:02 AM
Sandeep Singh ShekhawatPosted Oct 23, 2012, 1:51 AM
ds.Tables[0].Select(filterExpression); // will return all filter rows.
For example we create a method that returns dataTable in your case it is data set:
public static DataTable GetMovieData()
{
XmlReader xReader = new XmlTextReader("config.xml");
DataTable dt = new DataTable();
while (xReader.ReadToFollowing("ConnectionString"))
{
string connectionString = xReader.GetAttribute("Name").ToString();
SqlConnection con = new SqlConnection(connectionString);
SqlCommand cmd = new SqlCommand("Select * from Movies", con);
con.Open();
SqlDataReader reader = cmd.ExecuteReader();
dt.Load(reader);
}
return dt;
}
Now Filter data in table base on title in your case its name:
DataTable dt = ShowMovie.GetMovieData();
DataRow[] drc = dt.Select("Title = 'Gajani'");//Filtering Data Here
foreach (DataRow dr in drc)
{
Console.WriteLine(dr["Title"]);
}
kumar gPosted Oct 23, 2012, 1:10 AM
call linq query after adding event name coloumn added to data table which is in dataset
orderby rowlist.field