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 8508821
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T03:16:02+00:00 2026-06-11T03:16:02+00:00

I have the following code to select all counties given a stateid from a

  • 0

I have the following code to select all counties given a stateid from a counties table.

 Public Shared Function GetCountiesfromState(statename As String) As List(Of String)
    Dim context As New Model.teckEntities()
    Dim query = From c In context.counties Where c.stateId = 7 Select c
    Return query.ToList()
End Function

I get any error that query is returning a list of model. any thoughts on where the error lies?

  • 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-11T03:16:03+00:00Added an answer on June 11, 2026 at 3:16 am

    If there is a Name (or Title) field on the County entity, it should be as simple as:

    Public Shared Function GetCountiesfromState(statename As String) As List(Of String)
        Dim context As New Model.teckEntities()
        ' Here is the difference:
        Dim query = From c In context.counties Where c.stateId = 7 Select c.Name
        Return query.ToList()
    End Function
    

    In your code above you were selecting the c which, is a County entity, not necessarily a string property. By selecting c.Name (or c.Title) instead, you’ll be building a list of strings instead of a list of county entities.

    Cheers.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code: function isValidAuthor($authorID){ $query = SELECT * FROM jos_users WHERE
All, Say I have the following bit of code: select: function(start, end, allDay) {
I am using following zend code to select all data from a table where
i have following code: SELECT * FROM table WHERE thread = $thread AND (user
All, I have the following code: $qry = Select * from vendor_options order by
I have following method that I select all the ids from table and append
I Have following code with LINQ var q = (from web in DataContext.Webs select
I have the following code $result = $handle->select()->from('store_details') ->where('store_details.store_id=?', $id) ->columns('store_details.store_name'); //->query(ZEND_DB::FETCH_OBJ); However, when
I have the following code: @posts = Post.joins(:user).joins(:blog).select which is meant to find all
I currently have my index.html.erb showing the following code. <select name=country> <option>All</option> <%= country_options_for_select('All')

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.