locked
HELPPP! RRS feed

  • Question

  • User855913648 posted

    Line 81:         conn.Open()
    Line 82: ' Execute the Insert SQL
    Line 83: cmd1.ExecuteNonQuery()
    Line 84: ' SQL - To retrieve the new Order ID
    Line 85: cmd1.CommandText = "SELECT MAX(OrderID) AS maxOrderID FROM OrderData"



    [SqlException (0x80131904): The parameterized query '(@ShipName nvarchar(4),@ShipAddress nvarchar(3),@ShipCountry nva' expects the parameter '@DeliveryDate', which was not supplied.]
    System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +1951450
    System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4849003
    System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +194
    System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2394
    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
    Order.SaveOrder(ShopCart& objShopCart) in D:\Semester 2\ECAD\HMV\ECADAssignment1\App_Code\Order.vb:83
    Payment.btnConfirm_Click(Object sender, EventArgs e) in D:\Semester 2\ECAD\HMV\ECADAssignment1\Payment.aspx.vb:116
    System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
    System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
    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


    Anyone knows the error? help please!!
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565

    Friday, January 28, 2011 10:22 PM

Answers

  • User187056398 posted

    Line 83: cmd1.ExecuteNonQuery()
    Line 84: ' SQL - To retrieve the new Order ID
    Line 85: cmd1.CommandText = "SELECT MAX(OrderID) AS maxOrderID FROM OrderData"

     

    You should set the CommandText BEFORE you call ExecuteNonQuery.

    The error is probably from some existing SQL text that was already set in the command.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, January 28, 2011 11:58 PM
  • User-2139489267 posted

    If you already one more query that you used to run, then you've missed passing that parameter.

    The parameterized query '(@ShipName nvarchar(4),@ShipAddress nvarchar(3),@ShipCountry nva' expects the parameter '@DeliveryDate', which was not supplied.]

    Else go with the suggestion of SGWellens :)

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, January 29, 2011 12:05 AM

All replies

  • User187056398 posted

    Line 83: cmd1.ExecuteNonQuery()
    Line 84: ' SQL - To retrieve the new Order ID
    Line 85: cmd1.CommandText = "SELECT MAX(OrderID) AS maxOrderID FROM OrderData"

     

    You should set the CommandText BEFORE you call ExecuteNonQuery.

    The error is probably from some existing SQL text that was already set in the command.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, January 28, 2011 11:58 PM
  • User-2139489267 posted

    If you already one more query that you used to run, then you've missed passing that parameter.

    The parameterized query '(@ShipName nvarchar(4),@ShipAddress nvarchar(3),@ShipCountry nva' expects the parameter '@DeliveryDate', which was not supplied.]

    Else go with the suggestion of SGWellens :)

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, January 29, 2011 12:05 AM