VB Linq to straight VB

Larry Brister
Larry Brister used Ask the Experts™
on
Stupid question of the day...

How can I make the following linq statement into a straight vb statement

I'd like the results to be a datatable

            Dim Query = _
            (From Region In dataset1.Tables(0) _
             Where Region.Field(Of String)("Region") <> "" _
                    Select Region.Field(Of String)("Region") _
             ).Distinct().OrderBy(Function(item) item).ToList

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2012
Top Expert 2014

Commented:
Do you want to convert it to ADO.NET code to populate datatable or do you want to convert the result of this LINQ query into a datatable?

It is currently giving you a list of string which you can loop through.
Larry Bristersr. Developer

Author

Commented:
CodeCruiser

The end goal is something that a rabid "anti-linq" person could use.

You've been answering my questions for quite some time...I don't care one way or the other personally.
Most Valuable Expert 2012
Top Expert 2014
Commented:
From your "anti-linq" usage, I am assuming you want to get rid of the query.

If I remember correctly, you know how to use a tableadapter to populate a datatable so its a matter of constructing a sql query like below

SELECT DISTINCT Region From Regions Where Region Is Not Null And Len(Region) > 0 Order By Region
Larry Bristersr. Developer

Author

Commented:
Thanks.

I wrote the linq query with some EE help.

The other team members hate linq for some reason and want it out.

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