Executing multiple DbCommands in an open connection with Enterprise Library

Posted by Lieven Cardoen on Stack Overflow See other posts from Stack Overflow or by Lieven Cardoen
Published on 2010-03-18T10:07:22Z Indexed on 2010/03/18 10:11 UTC
Read the original article Hit count: 562

Filed under:
|

How can you execute multiple DbCommands with one connection?

Example:

var db = DatabaseFactory.CreateDatabase();
var dbCommand = db.GetSqlStringCommand(InsertCommandText);
...
db.ExecuteNonQuery(dbCommand);

Now, I want to be able to Execute multiple dbCommands. For instance in pseudo kind of code:

var db = DatabaseFactory.CreateDatabase();
var dbCommand1 = db.GetSqlStringCommand(InsertCommandText);
...
var dbCommand1 = db.GetSqlStringCommand(InsertCommandText);
...
Adding both commands to db
Executing them

© Stack Overflow or respective owner

Related posts about ADO.NET

Related posts about enterprise-library