Error migrating to .NET 2.0 : OracleCommand DBCommand cast error

  • Thread starter Thread starter eclypse
  • Start date Start date
E

eclypse

After migrating our application to .NET 2.0 we're getting the following
error message
Unable to cast object of type 'Oracle.DataAccess.Client.OracleCommand'
to
type 'System.Data.Common.DbCommand'

I'm using Oracle.DataAccess.Client.
I'm getting the same message whether I'm using ODP.NET 9.2 or 10

This is the code we're using :

Dim tblSchema As New DataTable()
Dim adpAdapter As New OracleDataAdapter(pSqlString, DbConnection)
adpAdapter.FillSchema(tblSchema, SchemaType.Source)

Fillschema causes the error

This code used to work fine with .NET 1.1.

Thanks,
Oz
 
The problem is probably "versions". Your
Oracle.DataAccess.Client.OracleCommand probably inherits from a different
version (1.1?) of DbCommand. And because they are SN'ed in GAC, you won't be
able to cast them and go your merry way. :(

Wait for a 2.0 version of ODP.NET? (February I think), or use Microsoft
OracleClient are reasonable solutions.


- Sahil Malik [MVP]
ADO.NET 2.0 book -
http://codebetter.com/blogs/sahil.malik/archive/2005/05/13/63199.aspx
 
Back
Top