Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP.Net Timeout in SQL 1

Status
Not open for further replies.

civilwarjunky

IS-IT--Management
Aug 26, 2004
19
0
0
US
I am need to ASP.net and I would like to know how to change the timeout string in the follow application.



Server Error in '/OrderEntry' Application.
--------------------------------------------------------------------------------

Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.]
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream) +742
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior) +44
OrderEntry.Location.GetLocationContact(Int32 LocationId)
OrderEntry.EditLocation.BindLocationData()
OrderEntry.EditLocation.Page_Load(Object sender, EventArgs e)
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +750




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET Version:1.1.4322.2032
 
you can change it on the sqlcommand object itself...

sqlcommand.Timeout = 120

"...we both know I'm training to become a cagefighter...see what happens if you try 'n hit me..."
 
I am new to .net and SQl working together where would I kind the the Sqlcommnad.timeout =120. Would it be in the SQL script itself or the .net page.
 
post your .Net code for querying the database...

"...we both know I'm training to become a cagefighter...see what happens if you try 'n hit me..."
 
Presumably you already have something like the following in your .net page:
Code:
        Dim MyDataReader As System.Data.SQLClient.SqlDataReader
        Dim MyCommand As System.Data.SQLClient.SqlCommand
        Dim MyConnection As System.Data.SQLClient.SqlConnection

        MyConnection = New System.Data.SQLClient.SqlConnection("server=127.0.0.1; initial catalog=Northwind;uid=USERNAME;pwd=PASSWORD")
        MyConnection.Open()
        MyCommand = New System.Data.SQLClient.SqlCommand
        MyCommand.Connection = MyConnection
        MyCommand.CommandText = "SELECT * FROM products"
        [b]MyCommand.CommandTimeout = 1800[/b]
Therefore you just add the CommandTimeout property (with whatever value you need) as I've highlighted above.

----------------------------------------------------------------------

Need help finding an answer?

Try the search facilty ( or read FAQ222-2244 on how to get better results.
 
<%@ Register TagPrefix="CRM" TagName="Header" Src="Controls/SiteHeader.ascx" %>
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="CustomerSummary.aspx.vb" Inherits="CRM.CustomerSummary" %>
<HTML>
<HEAD>
<title>DCC CRM Application</title>
<link href="Styles.css" type="text/css" rel="stylesheet">
</HEAD>
<body leftmargin="0" bottommargin="0" rightmargin="0" topmargin="0" marginheight="0" marginwidth="0">
<form runat="server" ID="Form1">
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr valign="top">
<td>
<CRM:Header id="Header" ShowTabs="False" runat="server" />
</td>
</tr>
<tr>
<td align="center" class="Normal">
<br>
<br>
<table align="center" cellpadding="0" cellspacing="0" width="500">
<tr>
<td align="left" colspan="4" class="Head">
Customer&nbsp;Summary By Program Report
</td>
</tr>
<tr>
<td align="left" colspan="4">
<hr align="left" width="100%" size="1" noshade>
</td>
</tr>
<tr>
<td colspan="4">&nbsp;
<asp:ValidationSummary id="ValidationSummary1" runat="server" CssClass="Normal" HeaderText="The following errors were detected:"></asp:ValidationSummary>
</td>
</tr>
<tr>
<td align="right" class="SubHead">
Industry:
</td>
<td width="5">
&nbsp;
</td>
<td align="left">
<asp:DropDownList id="ddlIndustry" runat="server" CssClass="NormalTextBox" Width="200" tabIndex="1"
AutoPostBack="True">
<asp:ListItem Value="0">All</asp:ListItem>
<asp:ListItem Value="4">Education</asp:ListItem>
<asp:ListItem Value="5">Health Care</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td align="right" class="SubHead">
Program Type:
</td>
<td width="5">
&nbsp;
</td>
<td align="left">
<asp:DropDownList id="ddlProgramType" runat="server" CssClass="NormalTextBox" Width="200" tabIndex="2"></asp:DropDownList>
</td>
</tr>
<tr>
<td align="right" class="SubHead">
Territory Manager:
</td>
<td width="5">
&nbsp;
</td>
<td align="left">
<asp:DropDownList id="ddlTerritoryManager" runat="server" CssClass="NormalTextBox" Width="200" tabIndex="3"></asp:DropDownList>
</td>
</tr>
<tr>
<td align="right" class="SubHead">
County:
</td>
<td width="5">
&nbsp;
</td>
<td align="left">
<asp:DropDownList id="ddlCounty" runat="server" CssClass="NormalTextBox" Width="200" tabIndex="4"></asp:DropDownList>
</td>
</tr>
<tr>
<td align="right" class="SubHead" height="24">
District:
</td>
<td width="5" height="24">
&nbsp;
</td>
<td align="left" height="24">
<asp:DropDownList id="ddlDistrict" runat="server" CssClass="NormalTextBox" Width="200" tabIndex="5"></asp:DropDownList>
</td>
</tr>
<tr>
<td align="right" class="SubHead">
City:
</td>
<td width="5">
&nbsp;
</td>
<td align="left">
<asp:TextBox id="CityField" runat="server" Width="200px" CssClass="NormalTextBox" MaxLength="128"
tabIndex="6"></asp:TextBox>
</td>
</tr>
<tr>
<td align="right" class="SubHead">
Start Date:
</td>
<td width="5">
&nbsp;
</td>
<td align="left">
<asp:TextBox id="StartDateField" tabIndex="7" runat="server" CssClass="NormalTextBox" Width="100px"></asp:TextBox>
<asp:RequiredFieldValidator id="RequiredFieldValidator1" runat="server" CssClass="Normal" ControlToValidate="StartDateField"
ErrorMessage="Start Date is Required">*</asp:RequiredFieldValidator>
<asp:CompareValidator id="CompareValidator1" runat="server" CssClass="Normal" ControlToValidate="StartDateField"
Type="Date" Operator="DataTypeCheck" ErrorMessage="Start Date Must be a Valid Date">*</asp:CompareValidator>
<asp:CompareValidator id="CompareValidator4" runat="server" CssClass="Normal" ControlToValidate="StartDateField"
Type="Date" Operator="LessThan" ErrorMessage="Start Date Must be Prior to End Date" ControlToCompare="EndDateField">*</asp:CompareValidator>
</td>
</tr>
<tr>
<td align="right" class="SubHead">
End Date:
</td>
<td width="5">
&nbsp;
</td>
<td align="left">
<asp:TextBox id="EndDateField" tabIndex="8" runat="server" CssClass="NormalTextBox" Width="100px"></asp:TextBox>
<asp:RequiredFieldValidator id="RequiredFieldValidator2" runat="server" CssClass="Normal" ControlToValidate="EndDateField"
ErrorMessage="End Date is Required">*</asp:RequiredFieldValidator>
<asp:CompareValidator id="CompareValidator3" runat="server" CssClass="Normal" ControlToValidate="EndDateField"
Type="Date" Operator="DataTypeCheck" ErrorMessage="End Date Must be a Valid Date">*</asp:CompareValidator>
</td>
</tr>
<tr>
<td colspan="3">
&nbsp;
</td>
</tr>
<tr>
<td colspan="2">
&nbsp;
</td>
<td align="left">
<asp:Button id="btnContinue" runat="server" CssClass="CommandButton" tabIndex="9" Text="Continue" />&nbsp;&nbsp;
<asp:LinkButton id="btnCancel" runat="server" CssClass="CommandButton" tabIndex="11" CausesValidation="False">Cancel</asp:LinkButton>
</td>
</tr>
</table>
<br>
<br>
<br>
</td>
</tr>
</table>
</form>
</body>
</HTML>
 
Any particular reason you have just posted all of your HTML?

----------------------------------------------------------------------

Need help finding an answer?

Try the search facilty ( or read FAQ222-2244 on how to get better results.
 
good point ca8msm...let's have the code behind posted if you're still uncertain as to where to put it...however, ca8msm's post is exactly how things should look...

"...we both know I'm training to become a cagefighter...see what happens if you try 'n hit me..."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top