472,371 Members | 1,579 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,371 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 2242
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: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
2
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
1
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
0
by: jack2019x | last post by:
hello, Is there code or static lib for hook swapchain present? I wanna hook dxgi swapchain present for dx11 and dx9.

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.