Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / March 2008

Tip: Looking for answers? Try searching our database.

How select just numeric values in LINQ?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ronald S. Cook - 05 Mar 2008 21:20 GMT
We have a table "Animal" that contains the column "AnimalNumber" 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
Jon Skeet [C# MVP] - 05 Mar 2008 21:34 GMT
> We have a table "Animal" that contains the column "AnimalNumber" with values
> like these:
[quoted text clipped - 14 lines]
> 100002
> 100003

Hmm... that sounds tricky, to be honest. Can you not either remove the
data from the server, or fetch the redundant data and then prune it out
on the client?

Signature

Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet   Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk

parez - 05 Mar 2008 22:09 GMT
I havent used linq but

you could try.

from number in numbers
                           where IsNumber(number)

write your IsNumber or use double.TryParse

> We have a table "Animal" that contains the column "AnimalNumber" with values
> like these:
[quoted text clipped - 17 lines]
> Thanks fror any help,
> Ron

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.