473,473 Members | 1,847 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

ExecuteNonQuery Query

This is a two part question.

(1) After opening a connection and calling ExecuteNonQuery within a
transaction in .NET 2.0, is any resource cleanup still required in a finally
block?

(2) My code calls the OpenRowset Bulk provider using a command query string,
but it seemed ExecuteNonQuery was the proper method to call because nothing
is returned. Is this correct?

--
Regards,

Fred Chateau
fchateauAtComcastDotNet
Aug 31 '06 #1
2 1537
Fred Chateau wrote:
(1) After opening a connection and calling ExecuteNonQuery within a
transaction in .NET 2.0, is any resource cleanup still required in a finally
block?
You still need to close the connection.

Arne
Sep 1 '06 #2
1) Close your connection again and dispose your command object
2) Not sure about that exact SQL, but ExecuteNonQuery is best when you
don't need a result set. It does return the number of rows affected
however, which you can choose not to assign if you so wish.
Fred Chateau wrote:
This is a two part question.

(1) After opening a connection and calling ExecuteNonQuery within a
transaction in .NET 2.0, is any resource cleanup still required in a finally
block?

(2) My code calls the OpenRowset Bulk provider using a command query string,
but it seemed ExecuteNonQuery was the proper method to call because nothing
is returned. Is this correct?

--
Regards,

Fred Chateau
fchateauAtComcastDotNet
Sep 1 '06 #3

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

Similar topics

2
by: Mark | last post by:
Hi, I have a sqlCommand object that I use to execute an SQL statement. I thought I could use the ExecuteNonQuery to test for the number of rows returned by the sql command but it does not seem to...
0
by: johnnymack0730 | last post by:
Hello - I am currently working on an asp.net application that needs to be able to update an access table using ExecuteNonQuery method. I have all the code setup, it runs, there are no errors...
4
by: MDW | last post by:
Hey all. I'm confused. I'm trying to add a single record into an Access 2000 database using ASP.Net. Here is the code: objConn = New OleDbConnection(strConnect) objConn.Open objCommand =...
1
by: DaveS | last post by:
Hi! I originally posted this in the dotnet.framework.adonet, but I'm not sure that was the right place. Anyway... I am exeuting an INSERT query from within a public function. Is there any...
22
by: b_r | last post by:
Hi, I'm trying to make a simple operation (insert into DB) in VB 2005 and SQL Server. The code is as follows: Dim sConnectionString As String = _ "Data...
5
by: Matt | last post by:
Hi all, I'm trying to use the following code in an application: // retrieve the connection string string strDbcx = Globals.strDbcx; // create the connection OleDbConnection dbcx = new...
0
by: nostradumbass77 | last post by:
Using Enterprise Library 2.0 (Jan 06) and .NET 2.0 (VB.Net 2005) Dim dbPF As Data.Common.DbProviderFactory Try dbPF = Data.Common.DbProviderFactories.GetFactory("System.Data.OleDb") db = New...
8
by: Tony M | last post by:
Shouldn't the ExecuteNonQuery be TRUE if it finds a record and FALSE is not? I get FALSE all the time and I seeded the database with the email address. I just want to check if record exist before...
2
by: fniles | last post by:
I am using VB.NET 2005 and MS Access. I use OLEDbCommand ExecuteNonQuery to delete a record from a database. Whenever the program gets a message, it creates a new thread to process that message....
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...
1
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
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.