Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post May 01, 2012 05:59 PM by gerrylowry
Apr 30, 2012 06:58 AM|LINK
I have a data table with ID, stringA, stringB.
I need to find the ID from the datatable based on stringC, which should between
stringA and stringB ranges.
Eg: Find the ID of GRAPE?
ID=1; string-A = APPLE TEST; string-B =
ID=2; string-A = ORGANIC TEST; string-B =
In this case, the answer would be 1. Because the string
GRAPE lies between APPLE... and ORANG..... .
Apr 30, 2012 07:14 AM|LINK
if (stringC > stringA && stringC < stringB)
then it is between (exclusive)
Apr 30, 2012 03:22 PM|LINK
string str =A + B ;
//logic to implement
Apr 30, 2012 11:46 PM|LINK
Error: "Operator '>' cannot be applied to operands of type 'string' and 'string'.
for the string comparison, I believe its not like the number comparison. you will get the above error.
Apr 30, 2012 11:49 PM|LINK
you will get the above error
(hint - you are trying to COMPARE things)
May 01, 2012 05:59 PM|LINK
@ aspmind TIMTOWTDI =. there is more than one way to do it
You need to study this MSDN article:
http://msdn.microsoft.com/en-us/library/cc165449.aspx "How to: Compare Strings (C# Programming Guide)"
FWIW, although it seems intuitively correct, with strings you can not AFAIK use >, <, et cetera.