.NET - "Specified cast is not valid" error when instantiating oleDBCommand
Posted on 2004-08-05
Specified cast is not valid.
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.InvalidCastException: Specified cast is not valid.
Line 12: Public Sub AddCart(ByVal CustomerID As Integer, ByVal ProductID As Integer, ByVal Qty As Double)
Line 13: 'Add a single row item to the cart
Line 14: Dim objCmd As New OleDbCommand("uspAddCart", objConn)
Line 15: objCmd.CommandType = CommandType.StoredProcedure
The error refers to line 14. At one stage this was working. Now all of a sudden it's not! And all functions containing code like line 14 now fail the same way. Any ideas please?