Checkout Problem
Hi,
I keep getting the error "No value given for one or more required parameters." when trying to update the quantity field in my checkout page. I have designed the page to identify the product via the cartitemID and created a text box to allow the customer to manually change the quantity field of each item. Code is below which is written in asp.net 1.1 with vb2003 :
Sub dgCart_Update(sender As Object, e As DataGridCommandEventArgs)
Dim strConnString As String = ConfigurationSettings.AppSettings.Get("ConnectionS tring")
strConnString = String.Format(strConnString, Server.MapPath("\db\nwguitars.mdb"))
Dim dbConnection As System.Data.IDbConnection = New System.Data.OleDb.OleDbConnection(strConnString)
Dim intCartitemID As Integer
Dim txtQuantity As TextBox
Dim intQuantity As Integer
intCartitemID = dgCart.DataKeys(e.Item.ItemIndex)
txtQuantity = e.Item.FindControl("txtQuantity")
intQuantity = txtQuantity.Text
Dim strSQL As String = "UPDATE [tblCartItems] SET [intQuantityOrder]=@Quantity WHERE "& _
"intCartitemID = @intCartitemID"
Dim dbCommand As New OleDbCommand(strSQL, dbConnection)
Dim cmd As New OleDbCommand
With cmd.Parameters:
.Add(New OleDbParameter("@Quantity", intQuantity))
.Add(New OleDbParameter("@intCartitemID", intCartitemID))
End With
dbConnection.Open()
dbCommand.ExecuteNonQuery()
dbConnection.Close()
dgCart.EditItemIndex = -1
dgCart.DataBind()
End Sub
Thanks
|