I have this enum:
public enum SupportedISOCurrencySymbol { DKK = 208, EUR = 978, NOK = 578, SEK = 752 }
I save the value for an order in the approved_orders table, Currency field.
I populate the sql insert query with a parameter like:
cmd.Parameters.AddWithValue("?Currency", this.Currency);
Well, If i do debug on the above line I clearly see that this.Currency has value DKK.
Why then it inserts in the DB: 208?
Do you have any ideea?
Thanks.
SupportedISOCurrencySymbol is an
enum, which has integer as base. “DKK” represents the number 208.What you are seeing in the debug window, is the value of
.ToString()on your enum, which is defined to return the name of the enum, not the value. If you want to send the string “DKK” to your database, you could simply state it explicitly:Of course, the columns involved in the database would then need to be of a compatible text type.