Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP & Decimal in SQL-server

Status
Not open for further replies.

Fredde

Programmer
May 10, 2001
22
0
0
SE
I have recently switched from Access to SQL-Server.

I'm trying to insert a value of SQL-type DECIMAL into my database from an input Texbox. My question is: how do I do it? Do I have to use CONVERT in my SQL-expression or can I cast the TextBox.value-string to a proper type?


sqlInsertCommand_Material.Parameters["@Price"].Value = TextBox_MaterialPrice.Text;

Where this parameter should be of SQL_Decimal type


/Fredrik
 
Try something like this
Code:
sqlInsertCommand_Material.Parameters["@Price"].Value = TextBox_MaterialPrice.Text.ToDecimal();
Good luck


What would you attempt to accomplish if you knew you would not fail?

Prayers are like junk mail, hardly looked at.
 
or
Code:
sqlInsertCommand_Material.Parameters["@Price"].Value = Decimal.Parse(TextBox_MaterialPrice.Text);

[pipe]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top