DataSet TimeOut expires

Posted on 2005-04-27
Medium Priority
Last Modified: 2008-01-09

The connection expires during   myAdapter.Fill(myDataSet, "TestTable")

        myAdapter = New SqlDataAdapter(sqlString, myConn)
        myDataSet = New DataSet
        myAdapter.Fill(myDataSet, "TestTable")

I have seen lot of examples on the net for  myCmd.CommandTimeout = 300, but that works only with sqlReader not with DataSet.

 How Can I fix timeout error? I know my query works. It takes close to 1 minute to run on sql server. Meanwhile asp application is throwing an error.
Question by:AnuPutcha

Expert Comment

ID: 13879833
It won't answer your question, but if a query is taking a full minute to run on sql server it's probably too much data to return at one time to a webpage. I would look at optimizing the query before increasing the server time out.

LVL 33

Expert Comment

ID: 13880605
You can also set the script timeout, this will probably fix your problem, but like Havagan said, 1 minute for a web-page result is pretty hefty.

Server.ScriptTimeout = 300
LVL 75

Expert Comment

by:Anthony Perkins
ID: 13881991

>>You can also set the script timeout, this will probably fix your problem<<
This is unrelated to ADO.NET and will have no effect.  The default timeout is 30 seconds for the CommandTimeout property.

>>but that works only with sqlReader not with DataSet.<<
There is nothing stopping you using the SqlCommand object when you instantiate the SqlDataAdapter
LVL 33

Expert Comment

ID: 13882006
true, you have to really combine the ado.net commandtimeout and asp.net's commandtimeout for it to work properly.
LVL 23

Accepted Solution

b1xml2 earned 2000 total points
ID: 13886524
myAdapter = New SqlDataAdapter(sqlString, myConn)
myDataSet = New DataSet
'to set the timeout for the command
myAdapter.SelectCommand.CommandTimeout = 300
myAdapter.Fill(myDataSet, "TestTable")

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month15 days, 1 hour left to enroll

840 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