Hi all,
In Chapter 8: Completing the order section (page 253).
I have gone through the errata, dig deep into debugging mode, and also even tried copy pasting files from the Complete folder. However, I am still getting this error
"Conversion failed when converting the varchar value 'Carnivore Special' to data type int." I think the problem is cmd.Parameters.Add("@ItemName", Data.SqlDbType.VarChar, 50) in Checkout.aspx.
vb but I couldn't find which code this ItemName being converted to type int??
Thanks in advance.
Code:
Conversion failed when converting the varchar value 'Carnivore Special' to data type int.
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: Conversion failed when converting the varchar value 'Carnivore Special' to data type int.
Source Error:
Line 130:
Line 131: ' Execute the query, inserting the cart item
Line 132: cmd.ExecuteNonQuery()
Line 133: Next
Line 134:
Source File: C:\Websites\PPQ\skeleton\Checkout.aspx.vb Line: 132
Stack Trace:
[SqlException (0x80131904): Conversion failed when converting the varchar value 'Carnivore Special' to data type int.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +1950954
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4846939
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +194
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2392
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +204
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +954
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +162
System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +175
System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +137
Checkout.Wizard1_FinishButtonClick(Object sender, WizardNavigationEventArgs e) in C:\Websites\PPQ\skeleton\Checkout.aspx.vb:132
[Exception: An error occurred while creating the order]
Checkout.Wizard1_FinishButtonClick(Object sender, WizardNavigationEventArgs e) in C:\Websites\PPQ\skeleton\Checkout.aspx.vb:159
System.Web.UI.WebControls.Wizard.OnFinishButtonClick(WizardNavigationEventArgs e) +108
System.Web.UI.WebControls.Wizard.OnBubbleEvent(Object source, EventArgs e) +641
System.Web.UI.WebControls.WizardChildTable.OnBubbleEvent(Object source, EventArgs args) +19
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +118
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +166
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) +1565