Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8111153
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T02:00:13+00:00 2026-06-06T02:00:13+00:00

VB examples please I need to return the same results from linq as I

  • 0

VB examples please

I need to return the same results from linq as I get using SQL

SELECT DISTINCT Area, Region
FROM dbo.Regions
Union
SELECT null,’All’
Order by 1,2

I use this for showing an “All” selecting in a combo box

My current linq points to a view that does the union for me but I want to know how to do it right in linq. I can’t figure out how to union a row for the null,’All’ values.

    Public Shared Function GetRegions(ByVal Area As String) As IEnumerable

        Dim DB As New SiteDBDataContext
        Return From values In DB.uv_Areas _
            Where values.Area = Area Or Area = "" Or values.Area Is Nothing _
            Order By values.Region _
            Select values.Area, values,Region

    End Function

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T02:00:17+00:00Added an answer on June 6, 2026 at 2:00 am

    You can’t do it in the DB with Linq to SQL or Entity Framework, but you can do it in memory with Linq to Objects:

    Public Shared Function GetRegions(ByVal Area As String) As IEnumerable
    
        Dim DB As New SiteDBDataContext
        Dim query = _
            From values In DB.uv_Areas _
            Where values.Area = Area Or Area = "" Or values.Area Is Nothing _
            Order By values.Region _
            Select New With { values.Area, values.Region }
    
        Dim all = { New With { .Area = DirectCast(Nothing, String), .Region = "All } }
        Return all.Concat(query)
    
    End Function
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please give me some examples of jump table usage. I have seen this example
Please see following examples first, and which one is better? Could you compare some
Please look at the two examples below: irb(#<ActionView::Base:0x2863d58>):030:0> paintings_path => /some-nice-alias-path irb(#<ActionView::Base:0x2863d58>):029:0> self.controller_name.to_s +
Please point me to some tutorials or other explaining examples about how to register
What is the difference, please explain them in laymen's terms with examples. Thanks!
http://docs.oracle.com/javase/1.5.0/docs/guide/jpda/trace.html Could anyone please provide me couple of examples of how to use Java
I'm a bit confused about the object references. Please check the examples below: class
I need to create a function pointer file. I am using perl for the
I'm inexperienced with sql in general, so using Hibernate is like looking for an
Help me with building object model, please. I need abstract class Unit representing each

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.