SQL Timeouts

SQL Timeouts

Controls featured in this example:

  • Sitecore Web Control

Classes featured in this example:

  • Sitecore.Configuration.Settings
  • Sitecore.Data.Items.Item

SQL Timeouts C# Web Control Code

Sitecore.Data.Items.Item item = this.GetItem();
if (item == null) return;

string defaultSqlTimeout = Sitecore.Configuration.Settings.DefaultSQLTimeout.ToString();
string defaultSqlTimeoutDays = Sitecore.Configuration.Settings.DefaultSQLTimeout.Days.ToString();
string defaultSqlTimeoutHours = Sitecore.Configuration.Settings.DefaultSQLTimeout.Hours.ToString();
string defaultSqlTimeoutMinutes = Sitecore.Configuration.Settings.DefaultSQLTimeout.Minutes.ToString();
string defaultSqlTimeoutTotalDays = Sitecore.Configuration.Settings.DefaultSQLTimeout.TotalDays.ToString();
string defaultSqlTimeoutTotalHours = Sitecore.Configuration.Settings.DefaultSQLTimeout.TotalHours.ToString();
string defaultSqlTimeoutTotalMinutes = Sitecore.Configuration.Settings.DefaultSQLTimeout.TotalMinutes.ToString();

output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Style, "font-weight:bold; width:100%; clear:both");
output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Div);
output.Write("C# Web Control Real-time Output");
output.RenderEndTag();

output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Style, "font-size:x-small; width:100%; clear:both");
output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Div);
output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Style, "font-weight:bold");
output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.P);
//using : for colon and   for space
output.Write("{0}: {1}", "Item", item.DisplayName);
output.RenderEndTag(); //P

output.Write("{0}&#58;&#160;{1}", "Default SQL Timeout", "<b>" + defaultSqlTimeout + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Default SQL Timeout Days", "<b>" + defaultSqlTimeoutDays + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Default SQL Timeout Hours", "<b>" + defaultSqlTimeoutHours + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Default SQL Timeout Minutes", "<b>" + defaultSqlTimeoutMinutes + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Default SQL Timeout Total Days", "<b>" + defaultSqlTimeoutTotalDays + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Default SQL Timeout Total Hours", "<b>" + defaultSqlTimeoutTotalHours + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Default SQL Timeout Total Minutes", "<b>" + defaultSqlTimeoutTotalMinutes + "</b>");

output.RenderEndTag(); //Div


SQL Timeouts C# Web Control Output

Default SQL Timeout: 00:05:00
Default SQL Timeout Days: 0
Default SQL Timeout Hours: 0
Default SQL Timeout Minutes: 5
Default SQL Timeout Total Days: 0.00347222222222222
Default SQL Timeout Total Hours: 0.0833333333333333
Default SQL Timeout Total Minutes: 5