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

Last Reply 5 months ago By Naresh.rj

Posted 5 months ago

hi

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

 neda

 

 

 

 

You are viewing reply posted by: Naresh.rj 5 months ago.
Posted 5 months ago

Hi Nedash,

Try using this 

 

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

 

I agree, here is the link: https://www.e-iceblue.com/Introduce/spire-office-for-net-free.html