"The connection is not open" error.

digitalenigma

Member
Joined
Mar 27, 2003
Messages
6
Hi,

Im building an application that employs multiple connections and references the Access and Excel 10.0 object libraries. I can make connections to Access DBs but when I try to connect to my Oracle DB, I get "The connection is not open."

As a test, I created a button with the following code:

Code:
Dim sCnOracle As String = "Provider=msdaora;Data Source=XXX;User ID=XXX;Password=XXX"
Dim cnOracle As New OLEDBConnection(sCnOracle)

cnOracle.Open()

cnOracle.Close()
cnOracle.Dispose()

An exception is thrown on cnOracle.Open(). Any ideas?
 
You could consider using the command object, and just pass it your connection:

C#:
OleDbDataAdapter myCommand = new OleDbDataAdapter(SQL, cnOracle);
 
Thanks for the suggestion, but I got it working. That snippet of test code was too simple to be buggy, so I created a new project, added all my references and imported all my code. Its working fine now.

Weird. When in doubt, new project!
 
Back
Top