Sharing one ADO SQL Server connection 
Author Message
 Sharing one ADO SQL Server connection

How can I open 1 ADO SQL server connection, and get all of my ActiveX DLL
classes to use it??

Does anyone have any samples?? or any help at all??

Thanks



Thu, 10 Oct 2002 03:00:00 GMT  
 Sharing one ADO SQL Server connection
Paul,

I use a class that exposes a Connection property that any
other class can access.

Mark Holder

Quote:

> How can I open 1 ADO SQL server connection, and get all of my ActiveX DLL
> classes to use it??

> Does anyone have any samples?? or any help at all??

> Thanks



Fri, 11 Oct 2002 03:00:00 GMT  
 Sharing one ADO SQL Server connection
Thanks for your reply....

How is this done??

Is there any sample code??

Thanks


Quote:
> Paul,

> I use a class that exposes a Connection property that any
> other class can access.

> Mark Holder


> > How can I open 1 ADO SQL server connection, and get all of my ActiveX
DLL
> > classes to use it??

> > Does anyone have any samples?? or any help at all??

> > Thanks



Fri, 11 Oct 2002 03:00:00 GMT  
 Sharing one ADO SQL Server connection
Paul:

The code would look something like this:

In a class module:

Private myConnection As ADODB.Connection
Public Property Set Connection(ByVal aConnection As
ADODB.Connection)
   Set myConnection = aConnection
End Property
Public Property Get Connection() As ADODB.Connection
   Set Connection = myConnection
End Property

A "login" form would create the connection, building a
connect string based on user input of name and password,
plus database info. The login form would pass the connection
in to the class with Property Set...

Other classes can reference the connection via Property
Get... statements.

Mark Holder

Quote:

> Thanks for your reply....

> How is this done??

> Is there any sample code??

> Thanks



> > Paul,

> > I use a class that exposes a Connection property that any
> > other class can access.

> > Mark Holder


> > > How can I open 1 ADO SQL server connection, and get all of my ActiveX
> DLL
> > > classes to use it??

> > > Does anyone have any samples?? or any help at all??

> > > Thanks



Fri, 11 Oct 2002 03:00:00 GMT  
 Sharing one ADO SQL Server connection
But the ActiveX DLL class(es) would have to have a 'connection' property
too, in order to pass the connection to it.  Assuming the ActiveX DLL does
not contain the main connection class.  Right?

It would seem to be a small pain to "set activexclass.connection =
execlass.connection" everytime one creates an object.

Jeff


Quote:
> Paul:

> A "login" form would create the connection, building a
> connect string based on user input of name and password,
> plus database info. The login form would pass the connection
> in to the class with Property Set...

> Other classes can reference the connection via Property
> Get... statements.

> Mark Holder



Mon, 14 Oct 2002 03:00:00 GMT  
 Sharing one ADO SQL Server connection
Jeff,

If the premise is that one class creates a Connection, and
other classes use it, it follows that the Connection must be
passed between them. This would normally be done by exposing
the Connection as a property of the class that created it,
and making the class that creates the Connection a property
of the classes that use it.

That way, the class that creates the Connection can raise an
event to notify all of its clients when the Connection is
closed (for example).

Mark Holder

Quote:

> But the ActiveX DLL class(es) would have to have a 'connection' property
> too, in order to pass the connection to it.  Assuming the ActiveX DLL does
> not contain the main connection class.  Right?

> It would seem to be a small pain to "set activexclass.connection =
> execlass.connection" everytime one creates an object.

> Jeff



> > Paul:

> > A "login" form would create the connection, building a
> > connect string based on user input of name and password,
> > plus database info. The login form would pass the connection
> > in to the class with Property Set...

> > Other classes can reference the connection via Property
> > Get... statements.

> > Mark Holder



Tue, 15 Oct 2002 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Sharing one ADO SQL Server connection

2. Crystal 5 Connecting to 2 ODBC connections (One SQL Server, the other ACCESS)

3. ado connection to SQL Server 7.0

4. IMPORTANT ado connection to remote sql server v.7

5. Visual Basic 6 and SQL Server Connections(ADO)

6. Problem creating an SQL Server trigger from ADO connection in VB

7. IMPORTANT ado connection to remote sql server v.7

8. ADO NT Trusted Connection String to SQL Server.

9. multiple connections with ADO to SQL server

10. ADO 2.0 connection to SQL Server 6.5

11. ADO Connection string to SQL Server

12. ADO connection string for SQL Server

 

 
Powered by phpBB® Forum Software