SolvedPrivate

VB Linq to straight VB

Posted on 2014-02-28
4
46 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 500 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
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…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

726 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