Access to .NET and Oracle Data

I am trying to do something like this:

Public Sub (ByVal boolTest As Boolean)
Dim objConnecton As System.Data.Common.DbConnection
Try

  If boolTest Then
         objConnecton = New SqlConnection
  Else
          objConnecton = New OracleConnection 
  End If
  Catch ex As Exception

Finally
  'Cleanup here
End Try

This works with version 2.112.1.0, Oracle.DataAccess, but not with version 10.2.0.100. With version 10.2.0.100, I get the following compilation error:

"A value of type" Oracle.DataAccess.Client.OracleConnection "cannot be converted to" System.Data.Common.DbConnection "

I am trying to initialize a connection object with an instance of SQLConnection or OracleConnection depending on the boolean value.

Why am I getting this error?

+3
source share
3 answers

Why am I getting this error?

(10.2+) Oracle .NET .NET Framework, DbConnection. , , , System.Data.Common.

+4

System.Data.IDbConnection ?

0

All Articles