how to sort system.data.datatable using select

Meinhoonaa
Meinhoonaa used Ask the Experts™
on
I have this select statement which is working great. I need to modify it to sort the value in ascending order. code shown below:

 Dim rows As DataRow() = dictionaryPlateTypes.Select("text LIKE '*" + [text] + "*' OR value LIKE '" + [text] + "*'", " text")
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
assuming there is a column namely text in your datatable.

Dim rows As DataRow() = dictionaryPlateTypes.Select("text LIKE '*" + [text] + "*' OR value LIKE '" + [text] + "*'", " text asc")

http://msdn.microsoft.com/en-us/library/system.data.datacolumn.expression.aspx
Most Valuable Expert 2012
Top Expert 2008

Commented:
If you have the right framework version, I would look into LINQ-to-DataSet extensions, since you can select with criteria, and order by in code.

Querying DataSets – Introduction to LINQ to DataSet
http://blogs.msdn.com/b/adonet/archive/2007/01/26/querying-datasets-introduction-to-linq-to-dataset.aspx

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial