Results 1 to 3 of 3

Thread: How to create a database dll with several classes

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Location
    Netherlands
    Posts
    3

    Question How to create a database dll with several classes

    Dear all,

    I want to create one dll for different programs in my company. Per program
    I want to create one class in the dll, but also some common classes, which
    contain functions that are used in more then one program. All functions
    are database related. How can I create a way to use one database
    connection through one of the common (main) classes, but use that
    connection in all of the functions in the other classes?

    Theoretic example:

    cls1 -> open connection1
    cls2 -> function1 using cls1/connection1 to query db
    cls3 -> function2 using cls1/connection1 to query db

    I've tried several thing, but they all ended up with opening another
    connection through cls1.

    Can you maybe give some example code when you give an answer?

    Thanks,
    Niels van de Coevering

  2. #2
    Fanatic Member simonm's Avatar
    Join Date
    Sep 2000
    Location
    Devon, England
    Posts
    796

    Lightbulb Connection Pooling

    I know this is not quite what you were asking for but have you considered taking advantage of connection pooling?

    Pass the connection string to each procedure that accesses the database and use that string to open a new connection object. If the connection string is identical to another connection (that has recently been used), this existing connection will be reused (instead of establishing a new one).

    NB: User name and Password must not be part of the connection string.

  3. #3

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Location
    Netherlands
    Posts
    3
    No, this is not quite what I need. The functions in the classes contain one sql statement. What the program does is that we scan in a barcode and after that serveral of these functions have to get recordsets back to the program, to be able to identify a lot of things. What we're even doing now is that we keep the connection to the database open, because it could be that we scan a barcode within 10 seconds and then we need a fast response from the program, as we now have withing one second.
    I want to make one dll for every program we have doing these kind of things, to get the recordsets. Because for all programs some functions we use are the same, but there are also different ones.

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