SQL Insert Help

Giganews Newsgroups
Subject: SQL Insert Help
Posted by:  Dot Net Daddy (cagriand…@gmail.com)
Date: 19 Aug 2006

Hello,

I cannot get the following Insert Command work. I get the error:

Error converting data type varchar to numeric.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Error converting
data type varchar to numeric.

However 'rate' and 'maximum' variables are declared as Decimal

Dim rate As Decimal
Dim maximumAs Decimal

SqlDataSource1.InsertCommand = "INSERT INTO Example(userName, rate,
maximum, ticket) VALUES('blabla','" & rate & "','" & maximum & "','" &
RadioButtonList1.SelectedValue & "')"

SqlDataSource1.Insert()

CREATE TABLE Example(
userName nvarchar(50),
rate decimal(2, 2),
maximum decimal(6, 2),
ticket nchar(1)
)

Replies