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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:19:53+00:00 2026-05-29T07:19:53+00:00

I am struggling to select multiple columns in the carCheckouts table. I just want

  • 0

I am struggling to select multiple columns in the carCheckouts table. I just want the startMiles and endMiles from one row that I know the pk of. Is my linq statement correct? if so how do I turn b.startMiles and b.endMiles into usable variables after? Thanks

var m = (from b in db.carCheckouts
where b.pk == primaryKey
select new {b.startMiles, b.endMiles});
  • 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-05-29T07:19:55+00:00Added an answer on May 29, 2026 at 7:19 am

    Your current query returns an IQueryable of an anonymous type – but it sounds like you want a single item:

    var m = (from b in db.carCheckouts
    where b.pk == primaryKey
    select new {b.startMiles, b.endMiles}).Single();
    

    Now you can use the properties of m just so:

    Console.WriteLine("Start Miles:"  + m.startMiles);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently struggling with a query that needs to retrieve multiple records from
I am trying to write a query that would select data from multiple lines
I am using a PHP mySQL query. Struggling with a Joins. mysql_query(SELECT * FROM
I am struggling with combining the below Select Statments, I know I could cheat
I've got an SQL query that returns all the rows in one table (country)
I'm struggling to create a search that searches for multiple words. My first attempt
I have an Invoice class that I want to have multiple Packages, but I
I have been struggling with the following query: select * from table_name where contains((field1,field2),'S.E.N.S');
I'm struggling to convert the following (simplified) HQL to QueryOver: select subscription from Subscription
Struggling with one aspect of my code that I hope someone could shed some

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.