We help IT Professionals succeed at work.

SQl dataadapter timeout during fill method

Medium Priority
1,218 Views
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
	sqladapter.Dispose()
 
	Return( ds )
End Function

Open in new window

Comment
Watch Question

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

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
Yes i checked that.... its localhost...
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");
 
and
 
sqlAdapter.SelectCommand.CommandTimeout = 0; 

Open in new window

Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.