重新present在SQL数据库中的一个颜色最好的方法? [英] Best way to represent a color in a SQL Database?

查看:141
本文介绍了重新present在SQL数据库中的一个颜色最好的方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我使用.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).

这篇关于重新present在SQL数据库中的一个颜色最好的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆