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


Top 5 Contributors of the Month
david stephan

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#
hi,
by using this statement
"SqlDataSource1.InsertParameters["TextBox8"].DefaultValue
= area;"
i got an error
ie,Cannot implicitly convert type 'float' to 'string'

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

Responses
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;

or

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

Thanks,
Amit
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
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

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