473,387 Members | 1,465 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Trouble converting smallmoney to decimal

Good morning everyone,

I'm having problems when I convert the SQL Server datatype smallmoney to
the .net datatype decimal. I am doing this to pass a dollor amount to
the Verisign payment gateway. Verisign requires that the amount passed
in is in the format ###.##, so if I have 250.50 its passed in exactly as
that. What is happening is that when I use 250.50 the decimal datatype
drops the last zero making this 250.5 which causes the gateway to return
an error stating that I used an incorrect amount. Does anyone have an
idea how I might fix this?

Thanks,

Aaron
Apr 6 '06 #1
1 3751
In numerical terms, the numbers 250.50 and 250.5 are exactly the same. What
you're talking about is the strings "250.50" and "250.5". A number isn't
formatted; a string is. What you're apparently sending to Verisign is a
string, not a number. So, you can format the string using a formatting
string - "###.00".

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Show me your certification without works,
and I'll show my certification
*by* my works.

"Aaron Prohaska" <mo******@gmail.com_No_Spam> wrote in message
news:ej**************@TK2MSFTNGP04.phx.gbl...
Good morning everyone,

I'm having problems when I convert the SQL Server datatype smallmoney to
the .net datatype decimal. I am doing this to pass a dollor amount to the
Verisign payment gateway. Verisign requires that the amount passed in is
in the format ###.##, so if I have 250.50 its passed in exactly as that.
What is happening is that when I use 250.50 the decimal datatype drops the
last zero making this 250.5 which causes the gateway to return an error
stating that I used an incorrect amount. Does anyone have an idea how I
might fix this?

Thanks,

Aaron

Apr 6 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Newbee Adam | last post by:
I have been reading in help how I need to use decimal becuase currency does not exist like I used in vb6. I had a difficult time on google and msdn finding how or if I can take the value of text...
7
by: Paul K | last post by:
I'm writing a small component that needs to be as fast as possible. The component needs to convert a string to decimal during the course of it's processing. However, I need to test the string...
1
by: mdawoodk | last post by:
i am getting error "input string was not in correct format" when converting a string decimal into integer value. code is like this: string strVal = ""; int nVal = 0; strVal = "14.9"; nVal...
3
by: Espen | last post by:
Code: <SCRIPT language="JavaScript"> Rente = "5,9"; Rente2 = parseFloat(Rente.replace(",",".")/100); document.write(Rente2 + '<br>'); Rente = "4,9";
116
by: Dilip | last post by:
Recently in our code, I ran into a situation where were stuffing a float inside a double. The precision was extended automatically because of that. To make a long story short, this caused...
4
by: tshad | last post by:
I am trying to get some information from Sql Server 2000 in my VS 2003 C# code. For example: if(dbReader != DBNull.Value) wsFilingStatus = (SqlMoney)dbReader; This gives me an error that...
10
by: Ron | last post by:
I want to calculate the surface area of a sphere from an inputed radius with option strict on. I guess I am not converting something correctly. Here is what I am doing: I have a textbox...
4
by: Jeff | last post by:
Hey ..NET 2.0 In my code am I trying to convert an int value into a decimal: decimal d = 0; int k = 87664; d = Convert.ToDecimal(k/100);
2
by: clintonb | last post by:
Victor said: The double value that I'm trying to convert to GCSMoney (which is implemented as cents) was produced by multiplying a dollar amount by an interest rate to get interest. double...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.