**Cross-post from CodeGuru**
I have written an application which by nature is often launched then shut down; each time creating then losing a connection to an Oracle database.
To avoid that, I am trying to create an ActiveX exe that would connect to the Oracle database once and for all. My application could then use the already created and maintained connection from the ActiveX exe.
To test things out and make sure my idea can work, I created two projects:
The ActiveX exe with just one Class - clsOracle containing the code below (with MS Ado 2.8 declared)
In a second project, I declare a reference to the first exe and try to connect - that part works fine. When I try to use the connection however, (RS.Open) I get an error (error 3001 - Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.)Code:Option Explicit Private m_OracleConnection As ADODB.Connection Private Sub Class_Initialize() Set m_OracleConnection = New ADODB.Connection m_OracleConnection.Open ORACLE_CONN_STRING End Sub Public Property Get OracleConnection() As ADODB.Connection Set OracleConnection = m_OracleConnection End Property Private Sub Class_Terminate() Set m_OracleConnection = Nothing End Sub
If I declared an ADO connection object instead of clsOracle and used it instead in the RS.Open statement, things would work just fine.Code:Option Explicit Dim test As ADODB.Connection Dim x As clsOracle Dim RS As ADODB.Recordset Private Sub Command1_Click() RS.Open "select max(length) from respool_fibers where respooling_end_date > sysdate - 120", test, adOpenForwardOnly, adLockOptimistic, adCmdText End Sub Private Sub Form_Load() Set x = New clsOracle Set test = x.OracleConnection Set RS = New ADODB.Recordset End Sub Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) Set test = Nothing End Sub
Am I approaching this all wrong? am I supposed to do something special when I compile the ActiveX exe?
Thanks for the help!!!


Reply With Quote