473,287 Members | 1,866 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

Reusing command objects.

4
I create a number of Global ADO Commands on Application Load. Every 30 seconds I use these to recreate Recordsets (Most of the RS are not global, so are recreated each time instead of just being refreshed/requeried). Those that are Global in scope can just be refreshed.

My question is, is what I'm doing correct, or should I close and recreated the Command Objects every 30 seconds. Currently I keep about 20 ADO Command Objects constantly active - these have the same connection and because I am not closing and reopening them each time I have Prepared set to True.

The other consideration is that for some of the Commands the parameters never change, but for others the Comand is called multiple times each 30 refresh with different parameters.

Thank you Neon.
Jul 5 '06 #1
3 1810
sashi
1,754 Expert 1GB
Hi there,

well.. opening recordset object whenever you need will be a good programming pratice.. there are a number of things to consider here.. i.e. the load to the database.. goog luck my fren.. :)
Jul 6 '06 #2
neonk
4
Thank you,

the question is however should I keep the CMD objects open all the time, or should I close them and open them again when I need to recreate the Recordset? Or atleast set the connection to nothing after refreshing the recordset and then resetting the connection as required. I do not need to destroy and recreate the CMD objects to achieve this I believe.

I am concerned about the number of open connections and Server load.

Neonk.
Jul 6 '06 #3
BSOB
77
the answer is that for impractical use it doesnt matter. but sashi is right with then "good programming practice". the cmd objects should only be opened just before use and closed just after use. this is to make sure that no strings are left hanging when the program quits. but again, refur to first sentence.
Jul 15 '06 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

14
by: Roger Binns | last post by:
It appears that xmlrpclib and/or SimpleXMLRPCServer always use new connections for each request. I have been trying to make them reuse the existing connection but can't find where. Is there any...
9
by: Alan | last post by:
Using VC++ (1998) compiler with PFE32 editor in Win2K Pro SP4. (DigitalMars CD on order. ) The program (below) instantiates a class and then deletes it. I would have thought that reusing the...
7
by: Klaus Johannes Rusch | last post by:
Is the following code valid and supported by current implementations? function somename() { this.show = function () { document.write("somename called") } } var somename = new somename();...
4
by: Old Wolf | last post by:
#include <stdio.h> #include <stdarg.h> Is this safe: void foo(const char *fmt, ...) { va_list ap; va_start(ap,fmt);
4
by: Tedb | last post by:
Is there any reason why you can't reuse a delegate object instance versus creating a new one each time? For example in the following scenario I have a DataPoints object with an array of DataPoint...
1
by: karye2004 | last post by:
Hi! I'm trying to access python objects from c++. It works once. Second time it hangs. Does someone have any clue or some example code or pointer? Thanks! /Karim Here are some python...
1
by: vbDavidC | last post by:
Hi, I am fairly new to .net and objects. I learned to create a reader object in method 1, however if I wanted to create multiple select queries in the same module I did not know how to reuse...
2
by: brazil.mg.marcus.vinicius.lima | last post by:
Hi, I'm constructing a query that will performs a lot o datetime calculumns to generate columns. All that operations are dependent of a base calculum that is performed on the query and its...
4
by: Looch | last post by:
All, I created a class in a windows application and I'd like to be able to pass an instance of that class as a method parameter to a web service. The class contains 100 variables. I tried adding...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.