Need Help with select

  • Thread starter Thread starter Dave Brown
  • Start date Start date
D

Dave Brown

Hi all

I have a DataTable containing all String datatypes.
I need to query the table for records where one of the fields numeric value
is between two other numeric values.

I've been trying the following
string val1 = '1';
string val2 = '2';

filt = "Field1 between '"+val1+"' and '" + val2 + "'"

i dont understand how to differentiate between string and numeric values in
a select, so any help apprecitiated.

rgds,

Dave.
 
Hi Dave,

Try using
"Convert(Field1, 'System.Int32') >= " + val1 + " and Convert(Field1,
'System.Int32') <= " + val2;
 
thanks ;)

Miha Markic said:
Hi Dave,

Try using
"Convert(Field1, 'System.Int32') >= " + val1 + " and Convert(Field1,
'System.Int32') <= " + val2;

--
Miha Markic [MVP C#] - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

Dave Brown said:
Hi all

I have a DataTable containing all String datatypes.
I need to query the table for records where one of the fields numeric value
is between two other numeric values.

I've been trying the following
string val1 = '1';
string val2 = '2';

filt = "Field1 between '"+val1+"' and '" + val2 + "'"

i dont understand how to differentiate between string and numeric values in
a select, so any help apprecitiated.

rgds,

Dave.
 
Back
Top