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
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

madinewalaRank #8,108 · 228 reputationPosted Aug 5, 2004, 3:32 AM EDT
madinewalaRank #8,108 · 228 reputationPosted Aug 5, 2004, 3:36 AM EDT