J
J. Clay
I am learning .net and am using the ASP.net Unleashed shopping cart as a
basis. I am attampting to convert it to use an Access DB. Everything is
working so far except for the adding of a shopping cart item. I receive the
following error:
OleDbCommand.Prepare method requires all parameters to have an explicitly
set type.
The VB Code is as follows:
' Retrieve the shopping cart
strSelect = "Select itemID, userID, ProductID, ProductName, UnitPrice,
Quantity From ShoppingCarts Where userID = ?" 'changed @userID to ?
_dadCart = New OleDbDataAdapter( strSelect, _conCart )
_dadCart.SelectCommand.Parameters.Add( "@userID", _guidUserID )
_dadCart.MissingSchemaAction = MissingSchemaAction.AddWithKey
_cbCart = New OleDbCommandBuilder( _dadCart )
_dstCart = New DataSet
_dadCart.Fill( _dstCart, "Cart" )
'Add a record
Public Sub Add( ProductID As Integer, ProductName As String, UnitPrice As
Decimal )
Dim drowItem As DataRow
....
drowItem = _dstCart.Tables( "Cart" ).NewRow
drowItem( "UserID" ) = _guidUserID
drowItem( "ProductID" ) = ProductID
drowItem( "ProductName" ) = ProductName
drowItem( "UnitPrice" ) = UnitPrice
drowItem( "Quantity" ) = 1
_dstCart.Tables( "Cart" ).Rows.Add( drowItem )
.....
UpdateCartDB
End Sub
Private Sub UpdateCartDB
_dadCart.Update( _dstCart, "Cart" )
End Sub
I have tried searching for references to this but am coming up short.
Any suggestions or guidance would be GREATLY appreciated.
TIA,
J. Clay
basis. I am attampting to convert it to use an Access DB. Everything is
working so far except for the adding of a shopping cart item. I receive the
following error:
OleDbCommand.Prepare method requires all parameters to have an explicitly
set type.
The VB Code is as follows:
' Retrieve the shopping cart
strSelect = "Select itemID, userID, ProductID, ProductName, UnitPrice,
Quantity From ShoppingCarts Where userID = ?" 'changed @userID to ?
_dadCart = New OleDbDataAdapter( strSelect, _conCart )
_dadCart.SelectCommand.Parameters.Add( "@userID", _guidUserID )
_dadCart.MissingSchemaAction = MissingSchemaAction.AddWithKey
_cbCart = New OleDbCommandBuilder( _dadCart )
_dstCart = New DataSet
_dadCart.Fill( _dstCart, "Cart" )
'Add a record
Public Sub Add( ProductID As Integer, ProductName As String, UnitPrice As
Decimal )
Dim drowItem As DataRow
....
drowItem = _dstCart.Tables( "Cart" ).NewRow
drowItem( "UserID" ) = _guidUserID
drowItem( "ProductID" ) = ProductID
drowItem( "ProductName" ) = ProductName
drowItem( "UnitPrice" ) = UnitPrice
drowItem( "Quantity" ) = 1
_dstCart.Tables( "Cart" ).Rows.Add( drowItem )
.....
UpdateCartDB
End Sub
Private Sub UpdateCartDB
_dadCart.Update( _dstCart, "Cart" )
End Sub
I have tried searching for references to this but am coming up short.
Any suggestions or guidance would be GREATLY appreciated.
TIA,
J. Clay