开发者

.net c sharp Console Application : timeout

开发者 https://www.devze.com 2022-12-13 23:26 出处:网络
I am creating a console application using Enterprise Library my code is somethinglike this DataSet ds = db.ExecuteDataSet(command);

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

精彩评论

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