I want to save a setting in MS SQL for .net Color. What data type in MS SQL should I use?
VARCHAR (length) The VARCHAR data type accepts character strings, including Unicode, of a variable length is up to the maximum length specified in the data type declaration.
Float Data Type Float is an approximate number data type used to store a floating-point number. float (n) - n is the number of bits that are used to store the mantissa in scientific notation. Range of values: - 1.79E+308 to -2.23E-308, 0 and 2.23E-308 to 1.79E+308.
The SQL Server float[(n)] data type complies with the ISO standard for all values of n from 1 through 53. The synonym for double precision is float(53).
Use Int32
, then use Color.FromArgb(Int32)
and Color.ToArgb()
to read and write, respectively. See: http://msdn.microsoft.com/en-us/library/ed705s37.aspx
The easy way would be to use color.ToArgb() to convert it to a 32-bit integer and store it as that. You can convert it back to a color using the static method Color.FromArgb(int).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With