.net - SQLHelper Class - ExecuteNonQuery Code Modification -


I just browse the code in SQLHelper Class V2 and I notice the following

 < Code> Public stable int execution query (SQL transaction transaction, command type command type, string command text, parameter SQL parametter [] command parameter) {if (transactions == empty) repeat new logic ("transaction"); If (transaction! = Null & transaction.connection == zero) throwing new logic exception ("Transaction rollback or committed, please provide an open transaction.", "Transactions"); // Create a command and prepare it for execution SqlCommand cmd = new SqlCommand (); Bool should CloseConnection = false; PrepareCommand (CMD, Transactions. Connection, Transactions, Type Commands, Command Text, Command Parameters, Should be Close Connection); // Finally, execute the command int retval = cmd.ExecuteNonQuery (); // Separate SqlParameters from Command Object, so that they can be used again cmd.Parameters.Clear (); Return return; }  

Is there any reason that the command is not within the "Use of Bolk"? I look at the use of "block access" elsewhere in the code.

My guess is that the reason is that the command is used in the entire scope of the function, so This will add additional code. Different developers prefer different implementations.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -