• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 285
  • Last Modified:

c# string compare condition

How to use compare or greater than condition like below.

"100" >= "700" in linq.


Currently, it alerts codes error.

Thanks
0
ITsolutionWizard
Asked:
ITsolutionWizard
  • 2
1 Solution
 
AndyAinscowCommented:
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.
0
 
Fernando SotoCommented:
Hi ITsolutionWizard;

You can't apply operators of type >=, >, <, <= because they are not defined for strings. What are you trying to achieve.
0
 
ITsolutionWizardAuthor Commented:
AndyAinscow: It came from the database. The column type is varchar(4).
0
 
AndyAinscowCommented:
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) ?
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now