Results 1 to 3 of 3

Thread: Usercontrols and DB connections

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2002
    Posts
    14

    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:
    1. If usercontrol.ambient.usermode = true then
    2.     cn.Open "Provider = ....... etc etc....)
    3. 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

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    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.

  3. #3

    Thread Starter
    New Member
    Join Date
    Mar 2002
    Posts
    14

    Smile 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
  •  



Click Here to Expand Forum to Full Width