2
Answers

Error Converting nvarchar to numeric

I have a webform that submits data to a SQL db via a stored procedure. When I test the SP all works fine. When I use the form I get an error indicating that there is an error converting nvarchar to numeric. I only have three fields that submit to numeric: cmd.Parameters.Add(new SqlParameter("@Version", Version.Text)); cmd.Parameters.Add(new SqlParameter("@Build", Build.Text)); cmd.Parameters.Add(new SqlParameter("@Cost", Cost.Text)); The table fields are setup as follows: @Version [numeric] (9), @Build [numeric] (9), @Cost [numeric] (9), I have attempted to initiate a Convert on the fields to no avail: cmd.Parameters.Add(new SqlParameter("@Version", Convert.ToInt32(Version.Text))); cmd.Parameters.Add(new SqlParameter("@Build", Convert .ToInt32(Build.Text))); cmd.Parameters.Add(new SqlParameter("@Cost", Convert.ToInt32(Cost.Text))); Is there anyone who has any idea how I can get past this error? Thank you. Tim
Answers (2)