B
Brad
I have a generic data access component that uses
interfaces to allow for multiple data providers. (I.E.
ODBC, OleDb, Sql) I built the component in VB .NET 2002
and it worked fine. I have now upgraded the component to
VB .NET 2003 and get run time errors when trying to cast a
System.Data.Odbc.OdbcConnection object to the
IDbConnection interface. The error I receive is:
System.InvalidCastException: Specified cast is not valid.
Here is a subset of my code:
Dim objConnection As Object
Dim cnn As IDbConnection
objConnection = CreateDataObject(strConnectionClass)
' CreateDataObject returns a
System.Data.Odbc.OdbcConnection object
cnn = CType(objConnection, IDbConnection)
The error occurs when executing the last line.
The CreateDataObject function uses reflection to create
the ODBC connection object.
Was something in the ODBC class set changed between 2002
and 2003 that would impact the type of casting I am
attempting?
Thanks!
- Brad
interfaces to allow for multiple data providers. (I.E.
ODBC, OleDb, Sql) I built the component in VB .NET 2002
and it worked fine. I have now upgraded the component to
VB .NET 2003 and get run time errors when trying to cast a
System.Data.Odbc.OdbcConnection object to the
IDbConnection interface. The error I receive is:
System.InvalidCastException: Specified cast is not valid.
Here is a subset of my code:
Dim objConnection As Object
Dim cnn As IDbConnection
objConnection = CreateDataObject(strConnectionClass)
' CreateDataObject returns a
System.Data.Odbc.OdbcConnection object
cnn = CType(objConnection, IDbConnection)
The error occurs when executing the last line.
The CreateDataObject function uses reflection to create
the ODBC connection object.
Was something in the ODBC class set changed between 2002
and 2003 that would impact the type of casting I am
attempting?
Thanks!
- Brad