i am using enum keyword to define set of values and the values are coming from database tables. I am not confident that this values will remain constant in database and in switch case statement we need to give constant values so..how to solve this problem..please reply me....
A:
If the values are not supposed to be constant they should reside in a database table and you should use a join to retrieve the actual value.
Mehrdad Afshari
2009-01-15 13:21:47
A:
I would use some kind of unique identifier for the database row. Not the identity field or the smart key but rather some type of abstract value or abbreviation. Then just reference that abstract value in the case statement instead of the value that will change.
Matt
2009-01-15 15:54:19
A:
If your application its the main access point to the database, or if you have others application that shared the same data access logic, you can use the enum values as contants in the switch statement, and store in the database the int values of the enum. So, when you retrieve the values from the db, you parsed them to get the enum value.
El Cheicon
2009-01-15 16:01:00