OleDbCommand oCommand = new OleDbCommand(); // connectionString is valid string (not shown here) OleDbConnection oConnection = new OleDbConnection(connectionString); oConnection.Open(); oCommand.CommandText = "SP_MyProc"; oCommand.CommandType = CommandType.StoredProcedure; oCommand.Parameters.AddWithValue( "@par1", cPar1 );The following is my replacement code (simplified):
IDbCommand oCommand; idbCommand = new OleDbCommand(); // connectionString is valid string (not shown here) OleDbConnection oConnection = new OleDbConnection(connectionString); oConnection.Open(); oCommand.CommandText = "SP_MyProc"; oCommand.CommandType = CommandType.StoredProcedure; oCommand.Parameters.AddWithValue( "@par1", cPar1 );The problem is that in the lower case code the method .AddWithValue has an error:
'System.Data.IDataParameterCollection' does not contain definition for 'AddWithValue'
What am I missing? TIA.