.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Melody Anderson
Eminent IT
Sandeep Singh

Home >> Forum >> C# >> Post New QuestionBookmark and Share Subscribe to Forum

convert string to float

Posted By: manju     Posted Date: October 28, 2009    Points:2   Category :C#
by using this statement
= area;"
i got an error
ie,Cannot implicitly convert type 'float' to 'string'

here in my database the data type of area is float.

Author: Amit Mehra             
Posted Date: October 28, 2009     Points: 5   

Hi Manju,

You are trying to insert string (area) to a float column. either you change the database column type if you want to insert "AREA" or change the value to float like this

one more thing is your TextBox8 is the parameter name? or you want to get value from TextBox8 and want to insert into database?

SqlDataSource1.InsertParameters["ParameterName"].DefaultValue = 1.2f;


SqlDataSource1.InsertParameters["ParameterName"].DefaultValue = Convert.ToSingle(TextBox8.Text);

Please "Mark As Answer " if this post help you.

Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend