• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3801
  • Last Modified:

DataSet TimeOut expires


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

        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.
0
AnuPutcha
Asked:
AnuPutcha
1 Solution
 
HavaganCommented:
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.

Paul
0
 
raterusCommented:
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
0
 
Anthony PerkinsCommented:
raterus,

>>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
0
 
raterusCommented:
true, you have to really combine the ado.net commandtimeout and asp.net's commandtimeout for it to work properly.
0
 
b1xml2Commented:
myAdapter = New SqlDataAdapter(sqlString, myConn)
myDataSet = New DataSet
'to set the timeout for the command
myAdapter.SelectCommand.CommandTimeout = 300
myAdapter.Fill(myDataSet, "TestTable")
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now