开发者

.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开发者_StackOverflow中文版 complete , so my come throws a time-out error.

Any idea how to overcome this.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜