?
SolvedPrivate

VB Linq to straight VB

Posted on 2014-02-28
4
Medium Priority
?
53 Views
Last Modified: 2016-02-10
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

0
Comment
Question by:lrbrister
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 39894758
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.
0
 

Author Comment

by:lrbrister
ID: 39894768
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.
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 2000 total points
ID: 39894944
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
0
 

Author Closing Comment

by:lrbrister
ID: 39894972
Thanks.

I wrote the linq query with some EE help.

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

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question