P
PokerMan
Hi
A common situation is a database using an ID number for a table and the
front end code needing to read this same id and store it back when used in
foregin key tables.
For example:
database table
RoomType
-------------
RoomTypeId
RoomType
and assume values
RoomType
--------------
1 | DoubleBed
2 | SingleBed
3 | Penthouse
etc
What i do is read that into my code and make an enum like:
enum RoomType{
DoubleBed,
SingleBed,
Penthouse
}
Is there a better way than this? My concern is what if the ids of the
roomtype table were ever changed? My code assumes they will never change and
so i just put my front end in sync with the ids. Am i using the right or an
acceptable methodology here?
A common situation is a database using an ID number for a table and the
front end code needing to read this same id and store it back when used in
foregin key tables.
For example:
database table
RoomType
-------------
RoomTypeId
RoomType
and assume values
RoomType
--------------
1 | DoubleBed
2 | SingleBed
3 | Penthouse
etc
What i do is read that into my code and make an enum like:
enum RoomType{
DoubleBed,
SingleBed,
Penthouse
}
Is there a better way than this? My concern is what if the ids of the
roomtype table were ever changed? My code assumes they will never change and
so i just put my front end in sync with the ids. Am i using the right or an
acceptable methodology here?