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, of Oracle.DataAccess, but does not with version 10.2.0.100. With version 10.2.0.100, I get the following compilation error:
"Value of type 'Oracle.DataAccess.Client.OracleConnection' cannot be converted to 'System.Data.Common.DbConnection'"
I am trying to initialise the connection object with an instance of either SQLConnection or OracleConnection depending on the value of the Boolean.
Why do I get this error?
Why do I get this error?
The later (10.2+) versions of the Oracle clients for .NET do not derive from the standard .NET framework classes, such as DbConnection. This has the unfortunate side effect of requiring a fair bit more work if you want to support multiple databases seamlessly, as you can no longer just use the base classes in System.Data.Common.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With