Connection.open for hangs indefinitely, no exception is thrown

前端 未结 2 994
庸人自扰
庸人自扰 2021-01-04 04:06

When I try to do the following code, the program hangs indefinitely. I don\'t know why and there seems to be other unanswered topics on the matter. Although, if the IP\\webs

2条回答
  •  太阳男子
    2021-01-04 04:47

    To get the connection to exit after a specified amount of time without success, you can use the Connection Timeout parameter in the connection string. The number you specify is in seconds, so for example, Connection Timeout=240 is equal to 240 seconds\60 seconds = 4 minutes.

    Sample connection string:

    
    

    In the above connection string, the Open() command will timeout after 10 seconds.

提交回复
热议问题