Hi!
I'm trying to filter a datatable without knowing any information about datatype of columns in the datable.
I thought using LINQ will be better for this situation but i've some problems with it.

Suppose that ,datatype of the columns can be any type,example : string,int32,double,datetime...etc

I'll filter datatable with comparison statements ( < , > , == , <= , >= )
How can i do it so that it will work with any datatype ?

Thanks in advance

try

int.Parse(Data.Value.toString());  //for int
double.Parse(Data.Value.toString());  //for double
decimal.Parse(Data.Value.toString()); // for decimal
DateTime.ParseExact(Data.Value.ToString(), "yyyyMMdd", new  System.Globalization.CultureInfo("en-US")); //for DateTime
Data.Value.toString();  /for String
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.