Tuesday, November 21, 2006

VB COLOR CONVERSION


What can we do with a VBColor in C#? For example, let's take vbRed = 255.
In C# we can choose:
Color.FromArgb(int red, int green, int blue)
Color.FromKnownColor(System.Drawing.KnownColor color)
Color.FromName(string name)
or an already named color.
These do not help.
However, if we convert the decimal 255 to hex, we get: 0000FF, a BGR value. This can be easily converted into an RGB value, and giving this string to Color.FromName("#FF0000"), we get the color we wanted from the first place.

exp: 12615935(dec) = C080FF(hex) in BGR = FF80C0(hex) in RGB
"#FF80C0" - gives in C# the color we wanted.

Friday, November 03, 2006

MSSQL RESULT CACHING

Strange issue:I have an sql user-function, which returns the result of a select statement, thus, a table. The server never stopped, and we modified something else in our database, and so, there should be a column with modified values in that table.The problem is, that while running the select statement of the function returns the expected result, calling the function by: select * from functionName ... returns the table with the original column values.From my opinion, this should only happen, if there is a result caching for user-defined-functions!
And it is the reason. For all stored procedures and function there is a result caching.The cache can be cleared with:

DBCC FREEPROCCACHE