Click here to Skip to main content
15,890,557 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Server Error in '/' Application.

Input string was not in a correct format.

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.FormatException: Input string was not in a correct format.

Source Error:


Line 48: }
Line 49: SqlDataAdapter adapter = new SqlDataAdapter(command);
Line 50: adapter.Fill(Result);
Line 51: return Result;
Line 52: }

Source File: c:\vhosts\adamtailoring.com\httpdocs\App_Code\DataProvider.cs Line: 50

Stack Trace:


[FormatException: Input string was not in a correct format.]
System.Number.ParseDouble(String value, NumberStyles options, NumberFormatInfo numfmt) +9416251
System.String.System.IConvertible.ToDouble(IFormatProvider provider) +46
System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider) +355
System.Data.SqlClient.SqlParameter.CoerceValue(Object value, MetaType destinationType) +5034544

[FormatException: Failed to convert parameter value from a String to a Double.]
System.Data.SqlClient.SqlParameter.CoerceValue(Object value, MetaType destinationType) +5033757
System.Data.SqlClient.SqlParameter.GetCoercedValue() +32
System.Data.SqlClient.SqlParameter.Validate(Int32 index, Boolean isCommandProc) +103
System.Data.SqlClient.SqlCommand.SetUpRPCParameters(_SqlRPC rpc, Int32 startCount, Boolean inSchema, SqlParameterCollection parameters) +126
System.Data.SqlClient.SqlCommand.BuildRPC(Boolean inSchema, SqlParameterCollection parameters, _SqlRPC& rpc) +73
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +987
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +162
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +32
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +141
System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) +12
System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) +10
System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +144
System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior) +166
System.Data.Common.DbDataAdapter.Fill(DataTable dataTable) +115
DataProvider.ExecuteCommondStoreProceduresReturnDataTable(String StoreProcedureName, MyParameterCollection myparameterCollection) in c:\vhosts\adamtailoring.com\httpdocs\App_Code\DataProvider.cs:50
ProductDAL.insertProduct(String productName, String price, String description, String categoryId, String moreInfo, String imgName, String imgDirectory) in c:\vhosts\adamtailoring.com\httpdocs\App_Code\ProductDAL.cs:93
Admin_Control_Panel_AddNewCategory.Button1_Click(Object sender, EventArgs e) in c:\vhosts\adamtailoring.com\httpdocs\Admin\AddNewProduct.aspx.cs:128
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +118
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
Posted
Comments
Karthik_Mahalingam 6-Jan-14 19:57pm    
post your sql code..
Member 10507230 7-Jan-14 19:32pm    
What is an sql code?
Karthik_Mahalingam 8-Jan-14 0:28am    
post your code..
some error in casting ..
refer this link
http://stackoverflow.com/questions/8321514/input-string-was-not-in-a-correct-format

1 solution

Careful with conversion, check this
How to: Convert a String to a Number (C# Programming Guide)[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900