Tuesday, February 14, 2012

Converting text to numeric

I have a database table with 2 numeric fields. The values to be inserted into these fields come from text boxes in an ASP.NET page. So in the parameters to add into these fields I simply use 'textbox1.text' & textbox2.text'.

One of the fields accepts the data within the text box and adds it into the appropriate numeric data field in the table. However on the other text box I get an error message 'Error converting data type nvarchar to numeric.'

Does anyone know why this occurs just on the one entry and not the other?, and if anyone has any suggestions on how to get around this please let me know.

Many ThanksWhat are the values of textbox1 and textbox2? If you have "fred" in textbox2, of course it cannot be converted to a numeric value.

No comments:

Post a Comment