Till now i'm creating two sql command for running two different queries. I wondering if the performance will change if i will run the same sql command for execute this two queries
Here is my method till now
using (SqlConnection connection = new SqlConnection(connectionString))
{
connection.Open();
using (SqlCommand command1 = new SqlCommand(commandText1, connection))
{
}
using (SqlCommand command2 = new SqlCommand(commandText2, connection))
{
}
// etc
}
Method 2
var command = new SqlCommand("<SQL Command>", myConnection);
command.ExecuteNonQuery();
command.CommandText = "<New SQL Command>";
command.ExecuteNonQuery();
Is there any difference in performance or it doesn't matter what i will use.