I retrieve numeric/decimal/money column values from SQL Server database as SQL_NUMERIC_STRUCT structures. Now I have to convert it to double for internal processing, and to string for GUI output. How can this be done?
I retrieve numeric/decimal/money column values from SQL Server database as SQL_NUMERIC_STRUCT structures. Now I
Share
Here is a good start. It doesn’t convert everything that you want to convert, but you can use the idea and algorithm to do arbitrary conversion with some simple mods:
You can easily create a double out of the resulting numerator and denominator by dividing the former by the later. Also, to create a string, you can always resort to
sprintfor for a more C++ way, the double formatter ofostringstream.