Solved

DB/VB design opinion request, be quick for the points.

Posted on 2002-06-26
13
140 Views
Last Modified: 2013-11-13
Hi,
This isn't a "how to" question; I know how to do both ways.  THis is a "which is best, and why" question:

I'm using VB client, Network based DB, max simultaneous users 20 viewing mostly different data (not transaction heavy), is it better to:

-Open a bunch of recordsets at client-startup & leave 'em open during session.

_OR_

-Open & close recordsets upon request of client each time DB access is necessary (which might be once evry 30 seconds to once every 10 minutes)

I'm currently using Access, but I'm gonna migrate to SQL Server or Oracle as soon as the LAN Admin guy gets his act together.  ADODB connection.  Sessions might last 3 to 8 hours.

Thanks in advance for sharing your experience & knowledge.

Bob
0
Comment
Question by:BobMiner
  • 4
  • 3
  • 3
  • +3
13 Comments
 
LVL 11

Accepted Solution

by:
joekendall earned 300 total points
ID: 7111220
I believe it is best to open and close recordsets as they are needed. You can keep the resources in your application to a minimum. Also, it can keep you from having problems with your DB.

Another option might be to create a COM object to manage your DB connections/recordsets.

Thanks!

Joe
0
 
LVL 10

Expert Comment

by:GoodJun
ID: 7111223
For 20 concurrent users, it really doesn't matter. The speed wise is the same (you can't tell the difference).
The second method is better if you want your app be more
scalable. It has the potential to use the new technology to scale to more users.
0
 
LVL 5

Expert Comment

by:bob_online
ID: 7111232
Load them as you need them.  Your app will start up faster and require fewer resources.

Unless you're executing massive, complex queries, running them as needed shouldn't be a performance problem.  Just be sure that as they are closed, all references are set to nothing.  With ado, I've found it's best to explicitly close the recordset and then set the recordset object to nothing.
0
 

Expert Comment

by:VBGuy91917
ID: 7111248
I would open disconnected recordsets on the client if you're not planning on having a lot of transactions on them to cut back on server traffic, unless you're on a dedicated server.  If there are other applications hitting that server, and you're connection is going to be open that whole time, and they may be hitting the server pretty hard, it could be more beneficial to have your recordsets open on the client.  That way, if someone else is hitting the server hard and causes it to crash, you still have your data.  

If there aren't any other applications hitting the server, or that aren't transaction heavy as well, then it probably wouldn't make too big of a difference.  
0
 
LVL 4

Expert Comment

by:gencross
ID: 7111416
I agree with joe and bob.  Open as you need them.
0
 
LVL 10

Expert Comment

by:GoodJun
ID: 7111486
gencross,
What's the difference between mine and theirs?
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 4

Expert Comment

by:gencross
ID: 7111535
GoodJun,

Joe and bob stated upfront that opening rs's as the user needs them is the better solution, not that it doesn't matter which method is used as you commented.  I did not want to state what the others already stated so I just said I agree with them.  

Not that I disagree with your entire comment.  Everything sounds good except..."For 20 concurrent users, it really doesn't matter.  The speed wise is the same (you can't tell the difference)."

There is good software design and bad software design, and in my opinion opening many rs's that may or may not be used is bad software design and poor use of resources.

That is my dissertation on why I agree with joe and bob.  I hope it was informative:)
0
 

Author Comment

by:BobMiner
ID: 7111655
I thank you all for the input especially after seeing other comments that beat you to the points.  I'll go with the consensus of "open as needed, then close".

I've asked support to award some points to GoodJun, bob online, and VBGuy91917 for your valueable opinions.

Regards,
Bob
0
 
LVL 10

Expert Comment

by:GoodJun
ID: 7111736
gencross,
>There is good software design and bad software design, and in my opinion opening many rs's that may or may not be used is bad software design and poor use of resources.

There are a lot of times open a bunch of rs at start up is the choice. (say, some library records you need often address, etc...). Design is depends on the situation. We can't say that maintain open rs is bad design. It has its places.
0
 
LVL 4

Expert Comment

by:gencross
ID: 7111900
Ok :)
0
 

Author Comment

by:BobMiner
ID: 7111901
Thanks again to all.
0
 

Author Comment

by:BobMiner
ID: 7115417
0
 

Author Comment

by:BobMiner
ID: 7272846
A couple of you guys have points to collect.
Thanks for the input.
Bob
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

943 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now