Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ado.net dataset select statement

Status
Not open for further replies.

hamking01

Programmer
May 30, 2004
238
US
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
 
You can use a DataView and filter it:
Code:
{
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.

----------------------------------------------------------------------

Need help finding an answer?

Try the search facilty ( or read FAQ222-2244 on how to get better results.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top