How select just numeric values in LINQ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ronald S. Cook

    #1

    How select just numeric values in LINQ?

    We have a table "Animal" that contains the column "AnimalNumb er" with values
    like these:

    100001
    100002
    100003
    1XAB
    10E43ABC
    11RU5V

    Having letters in the value was done in the past. These days, it's just a
    the numeric value.

    How can I write a LINQ statement to select only the numeric values? E.g.:

    100001
    100002
    100003

    Thanks fror any help,
    Ron

  • parez

    #2
    Re: How select just numeric values in LINQ?

    I havent used linq but

    you could try.


    from number in numbers
    where IsNumber(number )

    write your IsNumber or use double.TryParse

    Ronald S. Cook wrote:
    We have a table "Animal" that contains the column "AnimalNumb er" with values
    like these:
    >
    100001
    100002
    100003
    1XAB
    10E43ABC
    11RU5V
    >
    Having letters in the value was done in the past. These days, it's just a
    the numeric value.
    >
    How can I write a LINQ statement to select only the numeric values? E.g.:
    >
    100001
    100002
    100003
    >
    Thanks fror any help,
    Ron

    Comment

    Working...