2009-08-25 34 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 
}