SQl dataadapter timeout during fill method

Posted on 2009-02-17
Last Modified: 2012-05-06
I have a web page that loads data from a SQl server table.

Everytime the webpage loads it times out during the dataadapter.fill() function

This is what i tried.
1. Ran the same query in SQl server and it reurned the result set in 4 seconds.
2. Created a windows app with the same query and used a dataadapter to fill a dataset and diplay in grid. Worked in 5-6 seconds.
3. Increased the sqladapter.selectcommand.timout property to 0 and then the page never loads without any error displayed. only the non data part loads and the grid doent load.

This webpage worked fine when it was running on a webserver. But when i run it locally it timesout.

Public Function GetDataSet( s as String ) as DataSet

	if not CheckSql() then exit Function

	sqladapter = new SqlDataAdapter( sqlstr , conn )

	ds = new DataSet()

	sqladapter.Fill( ds , s )<<--- timeout


	Return( ds )

End Function

Open in new window

Question by:isaackhazi
    LVL 16

    Accepted Solution

    Check if the connection string is changed and is not pointing to the server on the internet.
    LVL 8

    Author Comment

    Yes i checked that.... its localhost...
    LVL 16

    Assisted Solution

    Try setting the connection time out in the connection string
    SqlConnection conn = new SqlConnection("server=localhost;uid=sa;pwd=123456;database=TestDB;Connection Timeout=90");
    sqlAdapter.SelectCommand.CommandTimeout = 0; 

    Open in new window


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (…
    Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
    Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
    Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.

    737 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

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now