Linq to SQL C# - number range
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 4 of 4

Thread: Linq to SQL C# - number range

  1. #1
    Join Date
    Sep 2011

    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;


  2. #2
    DataMiser is offline Super Moderator Power Poster
    Join Date
    Jul 2008

    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.

  3. #3
    Join Date
    Sep 2011

    Re: Linq to SQL C# - number range

    BETWEEN min AND max

  4. #4
    Join Date
    Jun 2001
    Melbourne/Aus (C# .Net 4.0)

    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.
    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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

This is a survey!

HTML5 Development Center