If I am using .Net and SQL Server 2008, what is the best way for me to store a color in the database, should I use ToString or convert it to an integer, or something else?>
If you are storing the System.Drawing.Color
, you need to store 4 bytes that represent the alpha and the 3 color channels. You can use a int
data type.
If you are storing the System.Windows.Media.Color
(from WPF), there are two possibilities depending on the usage you are using:
int
data type.color.ToString(CultureInfo.InvariantCulture)