PDA

Click to See Complete Forum and Search --> : Single Connection Object


ulbrichj
Jan 2nd, 2002, 11:35 AM
BACKGROUND:
I have an existing VB application that is a FAT client with all the GUI, Business and Data logic inter-mixed. This application is a simple client server application (the server is SQL 2000).

I want to break up the application so that the GUI code is seperate from the Business Logic which is seperate from the Data Access logic.

I have created an ActiveX DLL to house all the data logic. This DLL will exist on the client.


QUESTION:
I would like to create just one connection object when the client is started and use this conneciton object for all database calls.

Dim objCon As ADODB.Connection

In other words, I do not want to create a connection object each time I call one of the data service objects.

All of the data service object would make use of this one connection object.

I have not been able to figure out a way to make this work otherr than declaring a connection object in the main program and passing it into the Data Access object calls.


Users.GetUsersBySite(objCon,SiteID)

I would like to avoid having to pass in the connection object to every method I call.

Any ideas?

I have looked into making a Persistable cConnection class but I have not been able to get this to work.

Thanks.

parksie
Jan 2nd, 2002, 11:40 AM
You might want to try the General VB or Database Development forums.