2009-08-25 6 views
0

Est-il possible de regrouper des objets OracleCommand et de parcourir chaque OracleCommand de la collection?Grouper OracleCommand dans .NET

Quelqu'un pourrait-il publier un exemple de code pour y parvenir?

Merci.

Angelo

Répondre

1

Vous pouvez définir une liste et ainsi itérer sur ses produits

//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 
}