Error: Error converting data type nvarchar to float in ASP.Net

Last Reply one year ago By Naresh.rj

Posted one year ago


in database is Estate_info table that has column==Area with datatype=float

in edit.aspx page I define textbox that can change Area column in database:

below is code:

  _cmd.Parameters.AddWithValue("@zirbana", TxtzirB.Text);

but belwo error happen:

Server Error in '/' Application.

Error converting data type nvarchar to float.

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 nvarchar to float. Source Error:

Line 1369:                _cmd.Parameters["@Success"].Direction = ParameterDirection.Output;
Line 1370:
Line 1371:                _cmd.ExecuteNonQuery();
Line 1372:                lblErrorSubmit.Text = _cmd.Parameters["@Success"].Value.ToString();
Line 1373:            }


how I can insert textbox text into database

best regards






Posted one year ago
nedash says:
_cmd.Parameters.AddWithValue("@zirbana", TxtzirB.Text);

 Replace with the below code.

_cmd.Parameters.AddWithValue("@zirbana", Convert.ToDouble(TxtzirB.Text));