473,385 Members | 1,707 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,385 software developers and data experts.

Converting text to "money" datatype for dbase insertion

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" />

....but I need to do something extra with the SQL Parameter (in classic
asp, something like a CCur or CInt function did the trick).

????
chumley
Jul 21 '05 #1
1 2301
You will need to use Convert.ToDecimal() method to change the text to a
decimal type. The code would look like:

cmd.Parameters.Add(New SQLParameter("@amount",
Convert.ToDecimal(frmamount.text)))

Of course, you will want to validate the user's input to make sure that is
valid and can be converted to the decimal type.

Ben Lucas
Lead Developer
Solien Technology, Inc.
www.solien.com

"Chumley the Walrus" <sp*******@yahoo.com> wrote in message
news:1e**************************@posting.google.c om...
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" />

...but I need to do something extra with the SQL Parameter (in classic
asp, something like a CCur or CInt function did the trick).

????
chumley

Jul 21 '05 #2

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

Similar topics

0
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...
1
by: alien2_51 | last post by:
At some point after running this report the "Wholesale Price" column data type in the excel spread sheet changes from Currency to General... It seems to ba around the 300th or so row but varies......
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...
1
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...
81
by: Matt | last post by:
I have 2 questions: 1. strlen returns an unsigned (size_t) quantity. Why is an unsigned value more approprate than a signed value? Why is unsighned value less appropriate? 2. Would there...
1
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",...
4
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...
2
by: Randy Smith | last post by:
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...
1
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
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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,...
0
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.