views:

41

answers:

1

Hi,

Is it possible to group OracleCommand objects and iterate through each OracleCommand in the collection?

Could someone post a sample code in achieving this?

Thanks.

Angelo

+1  A: 

You can define a List and so iterate on its items:

//define a command
OracleCommand cmd1 = new OracleCommand("command", connection);
//set parameters if necessary
...
//do things
...

//declare a List of command
List<OracleCommand> commands = new List<OracleCommand>();
commands.Add(cmd1);

//using the list
foreach (OracleCommand command in commands)
{
     //...execute command and stuff
}
michele