Results 1 to 9 of 9
  1. #1
    3 Star Lounger
    Join Date
    Apr 2002
    Location
    Texas, USA
    Posts
    208
    Thanks
    0
    Thanked 1 Time in 1 Post

    ADO In VB (VB6 )

    I currently have an Access based program I put together several years ago for a former employer who now would like some changes to the program. I have decided to re-write the program in VB6 instead of Access. Mainly because the user no longer has Access for all of the sites that desire to use the program.
    I would like to use ADO for DB connectivity. I have looked at the ADO data control in VB6. I would like to have 1 global connection object for the app with each form having it's on recordset object and using the global connection object. I have found how to programmatically change the connection string for the ADO data control and bind all of the form's controls to it. What I do not know how to do is get the ADO data control to use the global connection object. Anyone have any thoughts? I also am open to any alternative suggestions to using the ADO data control. I just like the simplicity it offers by handling much of the work for me.

    Thanks
    Ed Carden

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: ADO In VB (VB6 )

    To be mildly facetious, this is a great idea if they are paying you by the hour, but it would probably be easier to keep it in Access and get the right to distribute the runtime (license Developer Edition of Office). <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

    Wouldn't a global connection be just a public variable?

    Unless there are some properties of the connection that need to be global, you might not need to have such an object. Even if you open and close a connection in various places, ADO will economize by storing the connection for some timeout period, and re-using it when a new connection is opened in your program. (This can be disabled, but will affect performance.) The re-opened connection doesn't retain the properties of the closed connection, but the overhead of reconnecting with the data source is reduced. Note that if you set the connection to Nothing before ADO 2.1, you couldn't re-use the connection in this manner. All recent versions retain the connection in the pool even if you destroy the object.

    I don't remember what the time-out is, but I think it can be increased if appropriate for your application.

  3. #3
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: ADO In VB (VB6 )

    Adding to JEscher's comments, our rule of thumb is that it typically takes 3 or 4 times as long to do a VB solution as it does to do an Access solution. And some things take far more than that - take subforms for example. So a run-time Access solution is a pretty attractive approach in my opinion.
    Wendell

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: ADO In VB (VB6 )

    I didn't thin ADO used session pooling unless you forced it to, Jefferson.
    Charlotte

  5. #5
    3 Star Lounger
    Join Date
    Apr 2002
    Location
    Texas, USA
    Posts
    208
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: ADO In VB (VB6 )

    I like the idea of using the developers edition and distributing the runtime but I do not own a copy of it and the pricing on the 2000 developers edition is still close to $1k. I am doing this as a favor and not getting paid so I'm not willing to spend any money on this. The transition to VB has been fairly easy so far. I know the report part will be a pain but with the exception of the question regarding which DB connection method to use the project has gone well.
    If anyone has any good recomendations on how I might get a copy of the Office Developers edition for a lot less than $1000 I would look at that.

    Thanks again

  6. #6
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ADO In VB (VB6 )

    I can't seem to find the link at the moment (somewhere on MS site), but keep in mind that the $1K pricetag includes the Developer edition of Office. If you already own Office, you can purchase only the Developer Tools (which gives you the extra documentation, addins such as the Packaging and Deployment Wizard, and the rights to distribute Runtime Access apps).

    The Developer Tools used to be about $400, but I imagine you could find it quite a bit cheaper.

    Also, regarding your original question: (Keep in mind I'm not much of a VB developer) You could try delaring the Connection object as a Public variable in a module: Public cnn as New ADODB.Connection. Then, after loading the Connection String and Opening the connection, continue using it as your active connection: rst.Open "<source>", cnn, adOpen...

    That way, you can recycle the Connection object with all of your forms until you decide to close and destroy it.

    HTH

  7. #7
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: ADO In VB (VB6 )

    Mmmm, not sure what session pooling is. "Connection pooling" is highly specific: a connection will only be re-used if the entire connection string matches, to preserve database security. Well, I can't very well differentiate something I know about from something I haven't heard of...

  8. #8
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: ADO In VB (VB6 )

    From Check Upgrade Eligibility:
    "You are eligible to upgrade to

  9. #9
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: ADO In VB (VB6 )

    We're talking about the same thing. It was late and my brain was tired ... or it was early and my brain was not awake. Any excuse will do for now. <img src=/S/evilgrin.gif border=0 alt=evilgrin width=15 height=15>
    Charlotte

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •