2009-08-25 74 views

回答

1

您可以定義一個列表,並在其項目,以便重複:

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