2011-11-07 63 views
0

更多我使用这个,当我创建一个命令:Command.StatementCompleted被调用一次

command.CommandType = CommandType.StoredProcedure; 
command.StatementCompleted += new StatementCompletedEventHandler(statementCompleted); 

但我的方法“statementCompleted”被称为不止一次了相同的命令。

有人有一个想法......

感谢

+0

什么是你的sql命令文本? – ChrisBint

回答

1

的StatementCompleted事件可以触发多次,如果你正试图运行SQL包含1个以上的SQL命令,如多重插入或更新条目。

+0

谢谢你有一个想法,我可以使用,最后被称为一次? – GregM

+0

不知道你需要。如果你调用ExecuteNonQuery或类似,下一行代码将运行(除非抛出SqlException) – ChrisBint