|
-
Apr 13th, 2002, 02:44 AM
#1
Thread Starter
New Member
Usercontrols and DB connections
I have created an .OCX project that consists of four individual usercontrol components. This/these components are for the use of my fellow developers. Some of the developers may use just two of the components, others might use them all. All the components are connecting to a database (access) using ADODB.connection. My problem is if a developer uses all of my components on a single form of a single project, the application takes too long to load (the connection is made four times). I have a public procedure within each component and I use the following code line(s) so that the connection is only made at run-time.
VB Code:
If usercontrol.ambient.usermode = true then
cn.Open "Provider = ....... etc etc....)
End If
Question:
Is it possible for a connection to be made just once for however many components are used? I can forecast a problem where my OCX project will contain as many as fifteen ocx components (each of which will make a connection) and a developer will use for example six or seven of these components.
Six connections = slow load of the application.

Note
I am querying a single ADODB.connection and not a single ADODB.recordset – each of the components are connecting to different tables.
Hope ive explained it well enough
thanks
-
Apr 13th, 2002, 03:11 AM
#2
It'd be easiest to expose the connection to the application that way the application can open 1 connection for all the controls it will support. Although the connections shouldn't really take that long and the components should use disconnected recordsets.
-
Apr 13th, 2002, 04:23 AM
#3
Thread Starter
New Member
hmmm....
thanks for your reply and advice.
that has given a liitle food for thought........
Just going to try somthing.
ill get back to you
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|