473,495 Members | 2,058 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Timeout expired. The timeout period elapsed prior to obtaining a connection from the

4 New Member
I get a timeout error using the code below. The Utils.GetDataTableForUI is calling a stored procedure(dbo.ConferencesSEL. The stored procedure does a simple select statement. Can someone tell me what I need to do to eliminate the timeout error on the page. Here is the code.

Expand|Select|Wrap|Line Numbers
  1. using System;
  2. using System.Data;
  3. using System.Configuration;
  4. using System.Collections;
  5. using System.Web;
  6. using System.Web.Security;
  7. using System.Web.UI;
  8. using System.Web.UI.WebControls;
  9. using System.Web.UI.WebControls.WebParts;
  10. using System.Web.UI.HtmlControls;
  11. using System.Text;
  12.  
  13. namespace HSI
  14. {
  15.     public partial class ofinterest_conferences : System.Web.UI.Page
  16.     {
  17.         protected void Page_Load(object sender, EventArgs e)
  18.         {
  19.             LoadConferences();
  20.         }
  21.  
  22.         private void LoadConferences()
  23.         {
  24.             StringBuilder sb = new StringBuilder();
  25.             DataTable dt = Utils.GetDataTableForUI("dbo.ConferencesSEL", null);
  26.  
  27.             foreach (DataRow dr in dt.Rows)
  28.             {
  29.                 sb.Append("<div class=\"infoContainer\">");
  30.                 sb.Append("   <p>");
  31.                 sb.Append("      <strong>" + dr["event_date"].ToString() +" : " + dr["title"].ToString() + " </strong><br />");
  32.                 sb.Append("      " + dr["location"].ToString());
  33.                 sb.Append("   </p>");
  34.                 sb.Append("   <p class=\"moreInfoWrap\">");
  35.  
  36.                 string urlPDF = string.Empty;
  37.                 if (!String.IsNullOrEmpty(dr["pdf_path"].ToString()))
  38.                 {
  39.                     urlPDF = (string)ConfigurationManager.AppSettings["pdfUploadPath"].ToString() + dr["pdf_path"].ToString();
  40.                 }
  41.                 else if (!String.IsNullOrEmpty(dr["url"].ToString()))
  42.                 {
  43.                     urlPDF = dr["url"].ToString();
  44.                 }
  45.  
  46.                 sb.Append("      <a href=\"" + urlPDF + "\" target=\"_blank\" class=\"moreInfo\">WANT MORE INFO</a>");
  47.                 sb.Append("   </p>");
  48.                 sb.Append("</div>");
  49.             }
  50.  
  51.             this.confContainer.InnerHtml = sb.ToString();
  52.         }
  53.     }
  54. }
Nov 13 '08 #1
7 1430
Plater
7,872 Recognized Expert Expert
Well your error message is cutoff in the title of your post (please remember to put the error message in the body of your post as well)

But it looks like it is timing out trying to connect to your database.
Check your connection string and verify that your program has the correct credentials/permissions to connect to the database, and that it is not blocked by any firewalls or anything
Nov 13 '08 #2
bootsy
4 New Member
Here it is:

Expand|Select|Wrap|Line Numbers
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Data;
  4. using System.Data.SqlClient;
  5. using System.Web.UI;
  6. namespace HSI 
  7. {
  8.   public class Utils : Page
  9.   {
  10.     public Utils();
Nov 13 '08 #3
Plater
7,872 Recognized Expert Expert
What is that ?
Nov 13 '08 #4
bootsy
4 New Member
What is that ?
That's the connection string to the Utils functiion
Nov 13 '08 #5
Plater
7,872 Recognized Expert Expert
That's the connection string to the Utils functiion
There is no connection string in that code. All you posted was your using statements
Nov 13 '08 #6
bootsy
4 New Member
There is no connection string in that code. All you posted was your using statements
Sorry I forgot to post the rest of the code



Also this:

Expand|Select|Wrap|Line Numbers
  1. public static DataTable GetDataTableForUI(string sproc, List<SqlParameter> sps) 
  2. {
  3.  
  4. SqlConnection conn = new SqlConnection((string)ConfigurationSettings.AppSettings["DBConnectionString"]); 
  5. conn.Open();
  6.  
  7. SqlCommand comm = new SqlCommand(sproc, conn); 
  8. comm.CommandType = CommandType.StoredProcedure;
  9.  
  10. if (sps != null) 
  11. {
  12.  
  13. for (int i = 0; i < sps.Count; i++) 
  14. {
  15.  
  16. comm.Parameters.Add(sps[i]);
  17.  
  18. }
  19.  
  20. }
  21.  
  22. SqlDataAdapter da = new SqlDataAdapter(comm);DataTable dt = new DataTable(); 
  23. da.Fill(dt);
  24.  
  25. return dt;
  26.  
  27. }
Nov 13 '08 #7
Plater
7,872 Recognized Expert Expert
Well that still doesn't include your connection string, because its referencing one stored in your web.config file.
Nov 13 '08 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1759
by: Silvia | last post by:
I have a application web and when execute this for a long time generated this error: Server Error in '/RAIMServer' Application. -----------------------------------------------------------...
3
11080
by: Kamalanathan T. | last post by:
Hi, We have developed an Web application in ASP.NET with C# and we r using SQL Server 2000. We get the Timeout expired error, when more than 300 concurrent users hit the site. I hagone thru...
4
23158
by: Guoqi Zheng | last post by:
Dear sir, I keep getting the following errors on one of my sites after clicking for many times. Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This...
5
13252
by: Jason | last post by:
Hi all I get the following error when executing a rather intense stored procedure from an ASPX page. I have tried: - Increasing timeouts on IIS 5.0 (all areas that even mention timeout) - use...
2
4558
by: Chris Langston | last post by:
I have a Web Server running IIS 5 or 6 on Windows 2K and Windows 2003 Server that is experiencing strange shutdown problems. We are using ASP.NET v1.1 and our application is written in VB.NET ...
4
4347
by: Nevyn Twyll | last post by:
I've been working on an asp.net application and everything's been great. But suddenly, whether I'm tyring to use a database on my own machine, or on my server, I'm getting a timeout when trying to...
4
13151
by: VB Programmer | last post by:
When I run my ASP.NET 2.0 web app on my dev machine it works perfect. When I precomile it to my web deployment project and then copy the debug files to my web server I get this problem when trying...
1
11038
by: Jake K | last post by:
I have a system timer that elapses every 10 seconds and must execute every ten seconds. Basically every 10 seconds I need to insert into a table. The following code, however, causes a "Timeout...
7
2739
by: =?Utf-8?B?Sm9obiBTdGFnZ3M=?= | last post by:
Hello, Please read this all before giving an answer :) I'm doing some troubleshooting on a web application that my company wrote. It's written in asp.net 1.1. The error that the Event viewer...
2
12599
by: anumsajeel | last post by:
Hi, Error Message:- error connecting: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were...
0
7120
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7160
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7196
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6878
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
4897
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4583
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3088
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
649
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
286
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.