Posted on: 7/7/2014 12:31:39 PM | Views : 331

Hi this is very simple but I just can't get it to work. I want to find the execution time of my insert transaction. I have the code but I don't really know where to place inside the code. I tried different places but it doesn't seem to work.
Execution time code:
DateTime dt1 = DateTime.Now; cmd.ExecuteNonQuery(); DateTime dt2 = DateTime.Now; TimeSpan duration = dt2 - dt1; Response.Write("Execution Time: " + duration.ToString());

My Insert Code:
try { int i = 0; int sum = (Convert.ToUInt16(TextBox1.Text));
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["GJWorkConnectionString"].ConnectionString); conn.Open();
SqlCommand cmd = new SqlCommand("DELETE from Timer", conn);
cmd.ExecuteNonQuery(); string insertQuery = "insert into Timer (ID,RandNum) values (@ID, @RandNum)";
while (i != s ...

Go to the complete details ...