|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Enum and Database questionI scratch my head but i'm only loosing my hair so far. 2 Records in tables table Person [Name] [FavSports] Nicolas 12 Frank 2 John 10 Those entries and specialy the FavSports are based on an enum with FlagsAttibute which allow multiple choice <FlagsAttribute()> _ public enum Sports None = 0 Soccer = 1 Tennis = 2 Hockey = 4 Swimming = 8 Football = 16 end enum Now I want to retrive from the database all person who have Tennis (2) as their favorite sport SELECT * FROM Person WHERE FavSport = ?????? ORDER BY Name Asc; I shoul get Frank and John So what who be the routin to get the proper SELECT Statement Thanks a lot for the help
Show quote
Hide quote
"Nicolas" <nlie***@hotmail.com> schrieb "SELECT * FROM Person WHERE (FavSport & @mask) = @mask ORDER BY Name Asc;"> What would be the Select Query for the following case. > I scratch my head but i'm only loosing my hair so far. > > 2 Records in tables > table Person > > [Name] [FavSports] > Nicolas 12 > Frank 2 > John 10 > > > Those entries and specialy the FavSports are based on an enum with > FlagsAttibute which allow multiple choice > <FlagsAttribute()> _ > public enum Sports > None = 0 > Soccer = 1 > Tennis = 2 > Hockey = 4 > Swimming = 8 > Football = 16 > end enum > > Now I want to retrive from the database all person who have Tennis > (2) as their favorite sport > > SELECT * FROM Person WHERE FavSport = ?????? ORDER BY Name Asc; > > I shoul get Frank and John > > So what who be the routin to get the proper SELECT Statement > > Thanks a lot for the help Set the value of Parameter "@mask" to Sports.Tennis. Or CInt(Sports.Tennis). Armin Thanks a lot
it's great Show quoteHide quote "Armin Zingler" <az.nospam@freenet.de> wrote in message CInt(Sports.Tennis).news:e6bvmp%23QGHA.2276@tk2msftngp13.phx.gbl... > "Nicolas" <nlie***@hotmail.com> schrieb > > What would be the Select Query for the following case. > > I scratch my head but i'm only loosing my hair so far. > > > > 2 Records in tables > > table Person > > > > [Name] [FavSports] > > Nicolas 12 > > Frank 2 > > John 10 > > > > > > Those entries and specialy the FavSports are based on an enum with > > FlagsAttibute which allow multiple choice > > <FlagsAttribute()> _ > > public enum Sports > > None = 0 > > Soccer = 1 > > Tennis = 2 > > Hockey = 4 > > Swimming = 8 > > Football = 16 > > end enum > > > > Now I want to retrive from the database all person who have Tennis > > (2) as their favorite sport > > > > SELECT * FROM Person WHERE FavSport = ?????? ORDER BY Name Asc; > > > > I shoul get Frank and John > > > > So what who be the routin to get the proper SELECT Statement > > > > Thanks a lot for the help > > > "SELECT * FROM Person WHERE (FavSport & @mask) = @mask ORDER BY Name Asc;" > > Set the value of Parameter "@mask" to Sports.Tennis. Or Show quoteHide quote > > > Armin >
creating independant application vb 2005 express edition
Access digital camera How to.... Question..... Can you insert elements into an XML file that exists as a string? MIDI guitar sheet music player in .net Refresh my memory on datatables, datasets etc. Enum and FlagsAttribute Changing the checked state of Dynamically added checkboxes ASP.net 2.0 Users (aspnet_Users table) create constraint problem Release File |
|||||||||||||||||||||||