How to transfer ado's _Connect pointer? 
Author Message
 How to transfer ado's _Connect pointer?

Hello,
I want to program 3 types of components.
One is ConnectionManger, which has a clients thread pool. Another is Entity,
which add, modify and delete data of one table of database. But this kind of
Entity should gain connection pointer from ConnectionMananger.
The ConnectionManager get the Connection Pointer from the third type of
component. It is DatabaseConnection. which task is create a ado connection
object.
One of DatabaseConnection's Interface is IDatabaseConnection and it has a
GetConnection member function.
Now I don't know how to write the function's output parameter. Should I
return two parameter, like following:
HRESULT GetConnection([out]IDispatch* _Connect, [out]IDispatch*
_Catalog,[out,retval]LONG* lErrorInfo).
or just one parameter.
HRESULT GetConnection([out]IDispatch* _Connect, [out,retval]LONG*
lErrorInfo);

1. I have read other's code but I don't know what's the use of Catalog and
How to use it.
2. Does the data type [out]IDispatch* is right? Should I use the
[out]IUnknown* here? Why? I think both Ok.Is it right?
3. Is there any more wrong here?

Thank you for your help.
--
kind regards/chenyu



Fri, 10 Oct 2003 14:49:52 GMT  
 How to transfer ado's _Connect pointer?


Fri, 19 Jun 1992 00:00:00 GMT  
 How to transfer ado's _Connect pointer?


Quote:
> Hello,
> I want to program 3 types of components.
> One is ConnectionManger, which has a clients thread pool. Another is
Entity,
> which add, modify and delete data of one table of database. But this kind
of
> Entity should gain connection pointer from ConnectionMananger.
> The ConnectionManager get the Connection Pointer from the third type of
> component. It is DatabaseConnection. which task is create a ado connection
> object.
> One of DatabaseConnection's Interface is IDatabaseConnection and it has a
> GetConnection member function.
> Now I don't know how to write the function's output parameter. Should I
> return two parameter, like following:
> HRESULT GetConnection([out]IDispatch* _Connect, [out]IDispatch*
> _Catalog,[out,retval]LONG* lErrorInfo).

error
HRESULT GetConnection([out]IDispatch** _Connect, [out]IDispatch**
_Catalog,[out,retval]LONG* lErrorInfo).

Quote:
> or just one parameter.
> HRESULT GetConnection([out]IDispatch* _Connect, [out,retval]LONG*
> lErrorInfo);

error
HRESULT GetConnection([out]IDispatch** _Connect, [out,retval]LONG*
lErrorInfo);

- Show quoted text -

Quote:

> 1. I have read other's code but I don't know what's the use of Catalog and
> How to use it.
> 2. Does the data type [out]IDispatch* is right? Should I use the
> [out]IUnknown* here? Why? I think both Ok.Is it right?
> 3. Is there any more wrong here?

> Thank you for your help.
> --
> kind regards/chenyu



Fri, 10 Oct 2003 18:17:56 GMT  
 How to transfer ado's _Connect pointer?


Fri, 19 Jun 1992 00:00:00 GMT  
 How to transfer ado's _Connect pointer?
First of all, you posted the exact same question twice with 2 different
subject headers ("IDL - Interface Parameter")... not good newsgroup
etiquette.

Using IDispatch** _Connect is perfectly acceptable, especially if it will be
used by Automation clients; however, if it will only be used by other C++
clients, you may want to use _Connection** Connect instead, to avoid an
extra QueryInterface call.  I would also caution your use of [out] if it
will be used in a scripting environment (you should use [in, out] instead).

Andy


Quote:
> Hello,
> I want to program 3 types of components.
> One is ConnectionManger, which has a clients thread pool. Another is
Entity,
> which add, modify and delete data of one table of database. But this kind
of
> Entity should gain connection pointer from ConnectionMananger.
> The ConnectionManager get the Connection Pointer from the third type of
> component. It is DatabaseConnection. which task is create a ado connection
> object.
> One of DatabaseConnection's Interface is IDatabaseConnection and it has a
> GetConnection member function.
> Now I don't know how to write the function's output parameter. Should I
> return two parameter, like following:
> HRESULT GetConnection([out]IDispatch* _Connect, [out]IDispatch*
> _Catalog,[out,retval]LONG* lErrorInfo).
> or just one parameter.
> HRESULT GetConnection([out]IDispatch* _Connect, [out,retval]LONG*
> lErrorInfo);

> 1. I have read other's code but I don't know what's the use of Catalog and
> How to use it.
> 2. Does the data type [out]IDispatch* is right? Should I use the
> [out]IUnknown* here? Why? I think both Ok.Is it right?
> 3. Is there any more wrong here?

> Thank you for your help.
> --
> kind regards/chenyu



Sat, 11 Oct 2003 06:04:04 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Can't connect to ADO

2. Problem with transfer parameters to a stored procedure using ADO

3. ASP.NET (ADO.NET) connect to remote MS Access Database

4. Connecting to DB using ADO

5. Example ADO connect and open please

6. Problem connecting to ORACLE via ADO - any help appreciated

7. Help: Connect to Oracle via MTS using ADO?

8. Connecting DB/2 with DAO or ADO?

9. Using OLE DB or ADO to connect Oracle and SQL Server

10. Question about using ADO to connect Oracle DB??Thank you

11. For VC++, ADO or OLEDB is better for connect remote Oracle 9i DB??Thank you

12. Problem in ADO while connecting with Oracle

 

 
Powered by phpBB® Forum Software