I've filled an datatable with an query from a database. I now need to select data from the datatable. Can I write an sql statement to further sort/find data from the table. Can anyone provide the proper syntax or links on how to do this? Thanx
{
DataView dv = new DataView(YourDataSet.Tables[0]);
dv.RowFilter = "SomeColumnName = " + SomeVariable;
}
For example if SomeColumnName = "UserID" and SomeVariable = 3 the above would translate to: "where UserID = 3". Anyway, a DataView is most likely your solution.
You can also use the Select method from the dataview table (DataView1.Table.Select) and this will allow you to enter a filter as shown above by Veep, but it will also allow you to sort the data.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.