Solved

using linq to return single value

Posted on 2009-07-16
1
1,345 Views
Last Modified: 2013-11-11
I have a table that is an hourly rate and only contains one value that is of type integer.

I need a linq helper method just to return this single value
0
Comment
Question by:mugsey
1 Comment
 
LVL 12

Accepted Solution

by:
GuitarRich earned 500 total points
ID: 24867786
try this - if you need to add filters in, just add a where clause before the select line.
int returnValue = (from t in Context.YourTable
                   select t.HourlyRate).SingleOrDefault();

Open in new window

0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.

825 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