I want to find only those row form table which contains numeric values , so for that I did as following
dtDetails.Select(" (ISNUMERIC(OriginatingTransit)=0)")
but it throws exception
The expression contains undefined function call ISNUMERIC().
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You’ll have to do that at the database level, or loop through yourself and write something that checks if a value can be parsed into a number. The Select method does not support what you’re trying to do: Expression property on MSDN, contains info about what’s supported.
And then you can do something like this:
If you then enumerate
filtered, you will get only those with numeric values in that column.This isn’t perfect – because as some comments mention on the answer linked to by Surjit Samra in the comments to your question above, the exact meaning of ‘is numeric’ is loose. This goes for the widest possible description, I think, by using
decimalto attempt to parse the value. You could use a different type (e.g.intorfloat), or a regular expression, perhaps, if your requirements are tighter.