Solved

Too many client tasks Error in asp.net with C#

Posted on 2014-02-10
3
278 Views
Last Modified: 2014-02-17
Hello Experts,

We developed one site with MS Access database and use DSN based connection. here my problem is the site give me error "Too many client tasks". i restart my server and it's solved but after sometimes it's again come. can you please suggest how can i resolve it.

Here i put my code.
 
using (OdbcConnection con = new OdbcConnection(conString))
            {
                con.Open();
                using (OdbcCommand cmd = new OdbcCommand(cmdText, con))
                {
                    cmd.CommandType = cmdType;
                    if (parameters != null)
                    {
                        foreach (OdbcParameter parameter in parameters)
                        {
                            if (null != parameter) cmd.Parameters.Add(parameter);
                        }
                    }
                    using (OdbcDataAdapter da = new OdbcDataAdapter(cmd))
                    {
                        DataSet ds = new DataSet();
                        da.Fill(ds);
                        return ds;
                    }
                }
            }

Open in new window

0
Comment
Question by:dotsandcoms
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 11

Expert Comment

by:John_Vidmar
ID: 39847233
You've instantiated an ODBCConnection object and opened a connection to the data-source... do you ever explicitly close the connection? (the code-snipet you provided does not close the connection).
0
 
LVL 20

Accepted Solution

by:
Daniel Van Der Werken earned 500 total points
ID: 39848428
The using statement auto-closes. What I think is happening is you are calling return within the using, thereby ending execution prior to the full close. Try this:
DataSet ds = new DataSet();
using (OdbcConnection con = new OdbcConnection(conString))
{
	con.Open();
	using (OdbcCommand cmd = new OdbcCommand(cmdText, con))
	{
		cmd.CommandType = cmdType;
		if (parameters != null)
		{
			foreach (OdbcParameter parameter in parameters)
			{
				if (null != parameter) cmd.Parameters.Add(parameter);
			}
		}
		using (OdbcDataAdapter da = new OdbcDataAdapter(cmd))
		{
			da.Fill(ds);
		}
	}
}
return ds;

Open in new window

0
 

Author Comment

by:dotsandcoms
ID: 39852732
Hello Dan7el,

I have updated the code as per your comments but still same error come. this error come in all sites which is hosted on the same server. so is there any settings in odbc connection to resolve it?
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question