473,748 Members | 5,429 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Re: Proper way to re-use OleDBCommand

sippyuconn wrote:
Hi

I have the code working - just want to make sure it is being coded correctly

I need to run thru a loop to insert multiple records thru Method
AddAuditMasterR ecord
I have the OleDBCommand setup and was wondering if I am initializing it
correctly and doing cleanup to optimize performance

1)Should I run cmdMaster.Param eters.Clear(); after each call to
cmdMaster.Execu teNonQuery(); or start Method AddAuditMasterR ecord with
cmdMaster = new OleDbCommand(in sertAuditDetail SQL, sqlCon); ??

2)I am useing IDisposible inteface to close connection on destcruction
Do I need to cleanup OleDBCommand ???

3)Anything else i should consider ???
The purpose of reusing a command is to set it up with parameters and
everything and then call the Prepare method. Then each time you use the
command you just assign values to the parameters and execute the command.

If you are going to add the parameters each time, there is no reason to
hang on to the command object either, you can just create a new command
object each time.

--
Göran Andersson
_____
http://www.guffa.com
Oct 3 '08 #1
0 1089

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
6264
by: Bruce W...1 | last post by:
For include files I see both the file extensions .php and .inc used. Which one is proper? Does it matter? What's the diff? Thanks for your help.
0
1652
by: T. Kaufmann | last post by:
Hi there, I have some lines of code in a Tkinter programm - I want to list every single file of a zip-archive in a Text widget: fp = os.popen("%s %s" % ('unzip -vl ', 'anyarchiv.zip', 'r') for line in fp: textWidget.insert(END, "%s" % (line)) The result is that the columns are not really proper if the file-size of the
2
3685
by: Kevin | last post by:
I am currently importing data into Access 2002 from 3 Sybase ASA 7.0 databases over a network. At this time I am using a ODBC System DSN connection using the proper ASA 7 driver. I would like to be able to make a DSN-Less connection so that my software is not dependent on having ODBC set-up with proper drivers and information. I have done hours of searching/testing but have been unsuccessful at making a DSN-Less connection. Could...
4
1750
by: Flip | last post by:
What is the proper/suggested/best way to deploy a webapp to a Win2K3 Server running IIS6? I am coming from the j2ee world (easy on the flames please, I'm moving to ..NET remember :>), and I've created a solution that has my four web apps contained in their own projects (correct me if that's not the proper way, but that's an easy way to manage webapps in JBuilder), and I was hoping I could create another project (?) to copy the files over...
1
14851
by: Lal | last post by:
Dear all, Is any method to covert to proper case? like STORE 'VISUAL FOXPRO' TO gcExpr2 ? PROPER(gcExpr2) && Displays "Visual Foxpro" please help
9
2077
by: liljencrantz | last post by:
Hi, I have a piece of code that uses hashtables to store pointers to various bits of data. The hashtable sees all pointers as const void *, while the application obviously uses various other pointer types for the data. I've run into a warning with the following code: void hash_remove( hash_table_t *h, const void *key, const void **old_key,
0
1279
by: yogarajan | last post by:
hi all i need proper alignment my treeview looks like <checkbox>Fruits(parent)-134 <checkbox>Mango(child)-45 <checkbox>Orange(child)-45 <checkbox>Apple(child)-34 <checkbox>Car(parent)-223
1
1856
by: gaurav92K | last post by:
sir, my pc is not proper shutdown. i turnoff my pc and i get that mouse curser are appear continues but it is not working at that time and the mouse light is on and monitor, cpu is also on. at last i switch off main supply for shutdown pc. what is this problem ? i think that window may be corrupted at any time because it is not proper shutdown. so please give the good idea to get rid of this problem. thanks....
1
1518
nurikoAnna
by: nurikoAnna | last post by:
how to properly separate sql codes........ I am using &_ as a separator...because it will not suits the visual basic code form...it will skip to the next line that's why I am having trouble in it Below is my code...please help me separate this using the proper separator and proper format if CESDBConn.execute ("SELECT `t_application`.`PersonalInfoID`,`t_application`.` DateOfApplication`,`t_application`.`SchoolLastAtte...
0
8987
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9534
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9366
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9316
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8239
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6793
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4597
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4867
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2777
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.