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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:12:49+00:00 2026-05-23T01:12:49+00:00

I use Asp.net 3.5 and EF 4. I need find a specific row in

  • 0

I use Asp.net 3.5 and EF 4.

I need find a specific row in my DataBase and display on a label a single value as string.

At the moment I use this code, it is working, so I find a single Object and read its properties.

 var myAuthor = (from at in context.CmsAuthors
             where at.AuthorId == myRow.AuthorId
             select at).Single();   
 myAuthorNameLabel.Text = myAuthor.LastName;

I would like to know:

  • If there is another syntax in Linq to achieve the same result.
  • How to do it using Lamba?
  • Which approach would you suggest me?
  • 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-23T01:12:50+00:00Added an answer on May 23, 2026 at 1:12 am

    You can use:

     var myAuthorName = 
    (from at in context.CmsAuthors where at.AuthorId == myRow.AuthorId select at).Single().Select(a => a.LastName);
    

    actually this would be even better:

    var myAuthorName = 
    (from at in context.CmsAuthors where at.AuthorId == myRow.AuthorId select at).Select(a => a.LastName).Single();
    

    Update

    An example of how to use with Anonymous type:

    var myAuthorNames = 
        (from at in context.CmsAuthors where at.AuthorId == myRow.AuthorId select at).Select( a => new {a.LastName, a.FirstName}).Single();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need my ASP.NET web application to use silverlight controls in my web page.
I need to use a dll in my asp.net application. How do I load
I use a System.Timers.Timer in my Asp.Net application and I need to use the
In asp.net mvc, when do we use: and Do we ever need to put
Suppose you have two seperate ASP.NET Web Application projects that both need to use
I'm trying to use SWFUpload with an ASP.NET Web Forms project. I need to
I have some ASP.NET Master Pages located in one assembly. I need to use
What is the actual use of TempData collection in asp.net MVC, I need pros
I use ASP.Net with NHibernate accessing a Pgsql database. For some of our Objects,
We use ASP.NET, C# When making an update to one of our websites, we

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.