Click here to Skip to main content
15,919,245 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

May I know how to store color name and its value in sql database?
What type of variable should I use for holding color name and its values?
Posted
Updated 19-Nov-10 22:56pm
v2
Comments
Dalek Dave 20-Nov-10 4:56am    
Edited for Grammar.

You can use Varchar field to store the color names & values. Reference HTML Color Names & Values[^]
 
Share this answer
 
Comments
sameertm 20-Nov-10 4:40am    
i stored the color name and its vlaue's by using varchar. but the problem is when i retrive the data from sql and apply color value to the control box its tshowing error like this "Specified cast is not valid." so what shall i do for this
thatraja 20-Nov-10 6:33am    
At least you should post some code you have tried, which control? where error occurs?
It depends on what color format you are using.
If you are using RGB you could use hex format or integers.

You could break RGB into three separate columns for greater flexibility - or you could store them together.
 
Share this answer
 
Comments
sameertm 20-Nov-10 4:46am    
may i know how and where i should set color format?
sameertm 20-Nov-10 4:52am    
and iam not storing RGB values, iam stroing only the color name?
Abhinav S 20-Nov-10 5:03am    
I would suggest you store the RGB value instead of the color name, unless you are using custom color names i.e. names you have created.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900