473,569 Members | 2,459 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Converting SQL Server "money" datatype to double????

Hi,
Does anyone have any good techniques on how to convert an SQL Server 2005
"money" datatype into the ASP.Net "double" datatype?

OR, should we be using "decimal" at both ends?

TIA, Randy Smith
Apr 18 '07 #1
2 15909
On Apr 18, 6:27 am, "Randy Smith" <rsm...@cta.org wrote:
Hi,
Does anyone have any good techniques on how to convert an SQL Server 2005
"money" datatype into the ASP.Net "double" datatype?

OR, should we be using "decimal" at both ends?

TIA, Randy Smith
I think decimal will work: Decimal m = (Decimal) dr["moneydatat ype"];

http://msdn2.microsoft.com/en-us/library/ms131092.aspx

Apr 18 '07 #2
On Apr 17, 11:27 pm, "Randy Smith" <rsm...@cta.org wrote:
Hi,
Does anyone have any good techniques on how to convert an SQL Server 2005
"money" datatype into the ASP.Net "double" datatype?

OR, should we be using "decimal" at both ends?

TIA, Randy Smith
Not sure if this is what you're looking for, but it will work...

double MyDouble =
double.Parse(dr dSQLDataReader. GetSqlMoney(MyO rdinal).ToStrin g());

where MyOrdinal is the ordinal/index of the data field in the current
row.

Apr 18 '07 #3

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

Similar topics

0
1899
by: Quinet, Joel | last post by:
Hi all, I use the Win32 extension (Build 157) module with Python 2.3 to add row in a sql server 2000 sp3 DB. My problem is I can not insert data of type money in the DB. I use the following command to create the parameter : prm = cmd.CreateParameter('Open', constants.adCurrency, constants.adParamInput, 8, 12.10)...
1
2549
by: Steve | last post by:
I have a million record mainframe flat file that I BULK INSERT into a SQL table with CHAR(fieldlength) deined for every column to prevent import errors. Once imported I "INSERT INTO ... SELECT dbo.MyScrubFunction(columnN),..." My scrub functions will take for example a char(8) YYYYMMDD date field and return either a valid datetime variable...
1
2323
by: Chumley the Walrus | last post by:
I'm trying to insert a value into sql dbase, the value "amount" is a money datatype (currency). Below is the parameter for the "amount" value: cmd.Parameters.Add(New SQLParameter("@amount", frmamount.text)) ....and how I am grabbing the "amount" from the textbox control: <asp:textbox id="frmamount" class="inputBox-gr" runat="server" />
1
2342
by: Stephane Charette | last post by:
QUICK VERSION: How do I create an index on a field of type "MONEY"? ----------------------------- LONG VERSION: I have a table with a field of type "money". I very often need to access records by the purchase price so I thought I'd create an index to help out my selects: CREATE INDEX purchasepriceidx ON mytable (purchaseprice);
3
18471
by: Ghost | last post by:
Hello. I have some problem to read Money Type Field from my database. I do so: I'm using SqlDataReader object to select some records and I have "float" type variable to store result. I write: myFloatVar = (float)mySqlDataReader; When this line executed the cast exception occurs.
3
3335
by: Sri | last post by:
In VB, to know the field type of a column stored in a recordset the command I use is If rsQuery.Fields(k).Type = adCurrency Then How will I achieve the same in ASP.net. I could not find a currency data type in asp.net and the type is idenfied as decimal. I have two fields defined in Sql-Server, one is money and other is decimal. In...
4
5135
by: Jerry | last post by:
Is it possible to turn off the "$" and "," that appear in "money" formatted columns so I can dump the table in a numeric format? The man page hints that lc_monetary controls the formatting but I cannot find any clues on what to do... Apparently money cannot be cast to anything. I don't think it will be hard to write a custom tcl/perl...
0
1634
by: Norman Yuan | last post by:
I posted this issue a while ago. After moveing the ASP.NET 1.1 app to a brand new server, the same problem still there. System: Winows2003 server std. .NET 1.1 App: Invoicing system Problem: Since the app is dealing with money amount a lot, in many place I used Double.ToString("C") to show a number as money amount on the web page. There
1
1256
by: jonesgirl620 | last post by:
I want to select a filed that is declared as money and have the output of that select statement be decial point free. Do I use Cast?
0
7618
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7926
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7982
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6286
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5514
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3656
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3644
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2116
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1226
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.