c# string compare condition

Posted on 2014-09-02
Last Modified: 2016-02-16
How to use compare or greater than condition like below.

"100" >= "700" in linq.

Currently, it alerts codes error.

Question by:ITsolutionWizard
    LVL 43

    Expert Comment

    To modify your example slightly.  Do you want a string comparison ("100" is less than "70")  or an numerical comparison (100 is greater than 70) ?  Where do these strings (numbers) come from.
    LVL 62

    Expert Comment

    by:Fernando Soto
    Hi ITsolutionWizard;

    You can't apply operators of type >=, >, <, <= because they are not defined for strings. What are you trying to achieve.

    Author Comment

    AndyAinscow: It came from the database. The column type is varchar(4).
    LVL 43

    Accepted Solution

    I did ask two questions.  The rather more important one is repeated now:
    Do you want a string comparison ("100" is less than "70")  or an numerical comparison (100 is greater than 70) ?

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
    IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    779 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

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now