Posto
Posto

Reputation: 7550

.net c sharp Console Application : timeout

I am creating a console application using Enterprise Library my code is something like this

 DataSet ds = db.ExecuteDataSet(command);

this actually calling a SP which take 10-15 minutes to complete , so my come throws a time-out error.

Any idea how to overcome this.

Upvotes: 0

Views: 3969

Answers (1)

Justin Grant
Justin Grant

Reputation: 46663

Before calling the ExecuteDataSet method, set command.CommandTimeout to however many seconds you're willing to wait before actually timing out. For example, if you're willing to wait 2 hours for the query to complete, set command.CommandTimeout to 7200.

You can set the CommandTimeout property to zero for an infinite timeout, but this is generally a bad idea since if something goes really wrong, you don't want to hang forever.

Upvotes: 4

Related Questions