Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Batches via ADO.Net

I have several INSERT, UPDATE, and DELETE commands I wish to use in a batch because they all refer to a temporary table (which will go out of scope if not in a batch).

Is there a way I can create a batch in ADO.Net? I am not able do what I am trying to do through a stored procedure on SQL Server.
[307 byte] By [Billkamm] at [2007-11-11 7:51:36]
# 1 Re: Batches via ADO.Net
First of all, a temporary table created outside of a stored procedure exists until you explicitly drop it or the connection is closed.

Second, a batch is just a number of SQL statements sent in one go. That's easily achieved with a SqlCommand object. Just string the commands together.

Rune
Rune Bivrin at 2007-11-11 23:47:43 >
# 2 Re: Batches via ADO.Net
Seperate commands with ";"

Are you sure you can't use a stored procedure?
Wiseman82 at 2007-11-11 23:48:38 >