-
September 5th, 2011, 10:05 PM
#1
Linq to SQL C# - number range
I would how I can complete this task
In VB I have created an application with 2 textboxes.
The user entered a min value in one box and a max value in the other box. I need it to pull from the DB the rows that have a record called BattingAverage that are between the 2 values enters.
I tried this for when user clicks the sumbit button but i am way off from where i need to be. I am JUST learning c# but i figured this would be pretty easy.. guess i was wrong :P
private void btnAverage_Click(object sender, EventArgs e)
{
playerBindingSource.DataSource =
from PlayerID in database.Players
where PlayerID.BattingAverage.CompareTo(txtMin.Text)
orderby PlayerID.LastName
select PlayerID;
}
-
September 5th, 2011, 10:44 PM
#2
Re: Linq to SQL C# - number range
in a nut shell the where would be something like
where battingavg >= min and battingavg <= max
Always use [code][/code] tags when posting code.
-
September 27th, 2011, 11:01 PM
#3
Re: Linq to SQL C# - number range
-
September 29th, 2011, 10:45 PM
#4
Re: Linq to SQL C# - number range
A this is a LINQ post I thought I'd link this LINQ link. I found this 'Dynamic LINQ' dynamic link library useful when I needed to build up LINQ queries on the fly.
Rob
-
Ohhhhh.... Old McDonald was dyslexic, E O I O EEEEEEEEEE.......
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|