Last post Jul 14, 2017 07:19 AM by Mikesdotnetting
Jul 14, 2017 06:09 AM|Ethan0k|LINK
There is a way to get execution time select command of sqldatasource?
Jul 14, 2017 07:19 AM|Mikesdotnetting|LINK
The Selecting event fires as the data source control begins the process and the Selected event fires when it has completed. You could use those events to start and stop a StopWatch instance to get the elapsed time: https://msdn.microsoft.com/en-us/library/system.diagnostics.stopwatch(v=vs.110).aspx
public partial class StopwatchTest : System.Web.UI.Page
Stopwatch watch = new Stopwatch();
protected void Page_Load(object sender, EventArgs e)
protected void SqlDataSource1_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
protected void SqlDataSource1_Selected(object sender, SqlDataSourceStatusEventArgs e)
Label1.Text = watch.Elapsed.TotalMilliseconds.ToString() ;
You need to add using System.Diagnostics; to the top of your code-behind file.