重新present在SQL数据库中的一个颜色最好的方法?最好的、数据库中、颜色、方法

2023-09-03 03:32:52 作者:毒药 |▍Posion

如果我使用.NET和SQL Server 2008中,什么是我要存储在数据库中的颜色最好的方法,我应该使用的ToString或将其转换为整数,或者其他什么东西?

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?

编辑:

我想要的颜色,以便能够检索和借鉴的东西在屏幕上以指定的颜色。我并不需要能够反对它查询。

All I want from the colour is to be able to retrieve it and draw something on the screen in the specified colour. I don't need to be able to query against it.

推荐答案

如何颜色本机存储?

如果你仅仅使用为0xRRGGBB格式,你不妨将其存储在数据库中的一个整数,并重新hexify它,当你 SELECT (为便于阅读)

If you're just using 0xRRGGBB format, you may as well store it as an integer in the database, and re-hexify it when you SELECT (for readability).