Hi, iam executin a query from c# windows application in against sql sever 2005, for this i want to dispaly the time taken to execute the query on the windows form, how to do it please tell me
How to calcuate the time taken to execute the query
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Kirtan PatelRank #292 · 8.6K reputationPosted Feb 27, 2010, 11:02 PM EST
about measuring Execution time of code ..
http://www.c-sharpcorner.com/UploadFile/kirtan007/ExecutionTime11032009101252AM/ExecutionTime.aspx?ArticleID=5bf8112c-7c77-4ad1-a0e4-9c142f66dc9d
kiran kumarRank #3,110 · 461 reputationPosted Feb 27, 2010, 11:09 PM EST
do like this
DateTime start = DateTime.Now;
//call the database and execute your sqlquery here
DateTime end = DateTime.Now;
TimeSpan duration =end-start;
//put a label and assign the duration to it like this
label1.Text = duration.TotalSeconds.ToString();
MARK THE ANSWER IF IT HELPS YOU