Drew Wutka
DWUTKA at marlow.com
Wed Mar 12 16:10:00 CST 2003
I don't really want to kick start another debate, but just exactly how does a Global work differently from VB to VBA? They work EXACTLY the same way, so how can one be better then the other? Drew -----Original Message----- From: Charlotte Foust [mailto:cfoust at infostatsystems.com] Sent: Wednesday, March 12, 2003 1:10 PM To: accessd at databaseadvisors.com Subject: RE: [AccessD] Using Global Connctions Globals work better in VB than in Access IMHO. But a global connection object is more than just a global variable, and I don't think there are really better ways to do that. Charlotte Foust -----Original Message----- From: Drew Wutka [mailto:DWUTKA at marlow.com] Sent: Wednesday, March 12, 2003 10:31 AM To: 'accessd at databaseadvisors.com' Subject: RE: [AccessD] Using Global Connctions Love Globals. They are just as reliable as any other code. If someone did, it would be me! <VBG> Sometimes. Yes, all the time. I 'hit and release' my ADO Connections all the time, especially when on a LAN. In fact, the first vergence from that practice just happened last night. I am working on a web interface to a Contact Request database. The database is on our Internet Web Server, and the Web interface is on our Intranet Web Server. Creating the connection through the network (from server to server) takes about half a second to a second (didn't really time it...). I have multiple classes working on each page, each of which require db interaction. Opening and killing the connection creates unacceptable delays (3 to 4 seconds per page load...I know that's not too bad, but in comparison to almost instantaneous pulls with the method I am using now, there is a big difference). So what I did, was take a major 'class', which represents information about the person logged in (it's used in every page), and I load an instance of that class, if it hasn't been loaded. If it has been loaded, I pull the class from a Session variable, which has already been loaded. That class keeps the connection open while the class is live, so I can then pass the connection object to other classes, keeping it open the entire time. With that method, the first page on the site (whatever page is hit) takes a few moments to load, but from that point on, the site runs as fast as the user can click. I left the default timeout of 10 minutes on the session object, so as long as the user doesn't wait more then 10 minutes before doing something on the site, they won't experience the temporarily delay in the main class loading. Drew -----Original Message----- From: Mark L. Breen [mailto:subs at solution-providers.ie] Sent: Wednesday, March 12, 2003 3:35 AM To: accessd at databaseadvisors.com Subject: [AccessD] Using Global Connctions Hello All, As a follow up to Susan Harkins discussion on the command object, How do you guys use a global connection in your apps What I have been doing is initialising gccnn when I load the app. It is G lobal C onstant cnn. I then use this Global variable for every ADO section of code. Do you hate global variables? do you think that they are unreliable? do you think that someone is going to come in the middle of the night and wipe it out? Do you use a class or property pass it around instead? In a fat client, LAN, does anyone initialise it and close it each time? (I presume not) Just intested in your feedback Thanks _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com