In-Process OLE Server and RDO Connection 
Author Message
 In-Process OLE Server and RDO Connection

Hi everyone!

Is it possible to pass an opened RDO connection to an In-Process OLE
server (DLL) and use it in there?

More details,
I have a customer object which is independent of the main application.
This customer object has a modal form in it with a bunch of controls.
It is used to Add, Update, Delete, Search customers in our database.
Knowing that opening connections is time consuming, I would like to
use the connection that is already opened in the main application.

In my Customer Object, I have a Create method which look like this.

Public Function Create(Optional ID As Variant, Optional SQLConn As
Variant) As Integer
        If Not IsMissing(SQLConn) Then
                Set m_SQLConn = SQLConn
        End If

        ...
        ...
End Function

In the main application where I call the customer object I have this

Dim nResult as integer    
Dim x As New AccountLibrary.CAccountGUI

' Where m_SQLConn is an opened RDO Connection
nResult = x.Create(SQLConn:=m_SQLConn)  

This code seem to fail all the time when I pass the Connection.
VB give me this error: Invalid Procedure Call. Runtime error 5.
If I call the same function without the m_SQLConn parameter,
everything seems fine. It seems that all my methods crash
when I pass parameters. Do I have to pass the params. ByVal??

Also I placed code in the Terminate event of my object to write to a
log file.
It seem that when I set the object reference to Nothing, the code in
the
terminate event is never executed. Am I doing something wrong??

Waiting for your comments!

Stephen Remillard

Montreal, Canada



Tue, 05 Jan 1999 03:00:00 GMT  
 In-Process OLE Server and RDO Connection



I had another idea for you to try as well, that may give you the best of
both worlds...

Quote:
> > Is it possible to pass an opened RDO connection to an In-Process OLE
> > server (DLL) and use it in there?
> > Public Function Create(Optional ID As Variant, Optional SQLConn As
> > Variant) As Integer

Within your function, do the following....

        Dim x As rdoConnection
        Set x = SQLConn

Then do x.rdomethods....

Maybe this'll work, and you can keep the optional argument

--
Barry Haun
EDS/Intelligent & Object Systems



Sun, 10 Jan 1999 03:00:00 GMT  
 In-Process OLE Server and RDO Connection



Quote:
> Is it possible to pass an opened RDO connection to an In-Process OLE
> server (DLL) and use it in there?

I believe so -- see below for what to try.

Quote:
> More details,
> In my Customer Object, I have a Create method which look like this.
> Public Function Create(Optional ID As Variant, Optional SQLConn As
> Variant) As Integer

SQLConn is not a Variant, it is an object of type rdoConnection.  I know
you have to use Variant to make this an optional parameter, but the OLE DLL
probably needs an object type.  You may have to make these parameters
non-optional (suggestion -- just allow them to accept null values) and try
declaring it like this:

Public Function Create(ID as String, SQLConn as rdoConnection)

I wish I could say I've tried this and it works, but I haven't.  I HAVE
successfully passed rdoConnection references around between instances in
the same process, but not with an OLE DLL.  Please let me know if you try
this and how it comes out...
--
Barry Haun
EDS/Intelligent & Object Systems



Sun, 10 Jan 1999 03:00:00 GMT  
 In-Process OLE Server and RDO Connection

Hi there,

        Simple, here is the formula :

        RDOConnect is an OBJECT type, declare it as such. For Example :

        Sub Test(ConnectionObject as Object)
                ConnectionObject.Method
        End Sub

        The main problem i see in your case is that your parameters are
Optionnal. I don't believe it's possible to pass Optionnal parameters
other than Variant.

        Hope this helped you !

                        Au revoir

--
Fran?ois C?te
2177 St-Jean Baptiste
Ancienne-Lorette (Qubec)
Canada


Quote:
> Hi everyone!

> Is it possible to pass an opened RDO connection to an In-Process OLE
> server (DLL) and use it in there?

> More details,
> I have a customer object which is independent of the main application.
> This customer object has a modal form in it with a bunch of controls.
> It is used to Add, Update, Delete, Search customers in our database.
> Knowing that opening connections is time consuming, I would like to
> use the connection that is already opened in the main application.

> In my Customer Object, I have a Create method which look like this.

> Public Function Create(Optional ID As Variant, Optional SQLConn As
> Variant) As Integer
>    If Not IsMissing(SQLConn) Then
>            Set m_SQLConn = SQLConn
>    End If

>    ...
>    ...
> End Function

> In the main application where I call the customer object I have this

> Dim nResult as integer    
> Dim x As New AccountLibrary.CAccountGUI

> ' Where m_SQLConn is an opened RDO Connection
> nResult = x.Create(SQLConn:=m_SQLConn)  

> This code seem to fail all the time when I pass the Connection.
> VB give me this error: Invalid Procedure Call. Runtime error 5.
> If I call the same function without the m_SQLConn parameter,
> everything seems fine. It seems that all my methods crash
> when I pass parameters. Do I have to pass the params. ByVal??

> Also I placed code in the Terminate event of my object to write to a
> log file.
> It seem that when I set the object reference to Nothing, the code in
> the
> terminate event is never executed. Am I doing something wrong??

> Waiting for your comments!

> Stephen Remillard

> Montreal, Canada



Mon, 11 Jan 1999 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. In-Process OLE Server and RDO Connection

2. Works ok as Inprocess Server but not as Out process

3. Setup with OLE inprocess server

4. Access95, InProcess OLE Server, Security and incorrect SystemDB

5. RDO connection - argument between processes

6. RDO connection - argument between processes

7. Share RDO connection between OLE objects?

8. InProcess server written in VB

9. Client, Remote OLE Server and RDO

10. RDO Connections And SQL Server

11. OLE Out-Of-Process servers

12. 16-bit Out-of-process OLE servers not working with VB5

 

 
Powered by phpBB® Forum Software