日期:2014-05-18 浏览次数:20712 次
'连接数据库 Public Function GetConnection() As ADODB.Connection Dim con As ADODB.Connection 'ADO连接 Set con = New ADODB.Connection con.ConnectionString = "Provider=SQLOLEDB;Server=lws-db;Initial Catalog=PL2010_back;User Id=pl;PASSWORD=pluser;timeout= 0" Set GetConnection = con End Function
waitfor delay '00:00:31'--等待31秒
waitfor delay '00:00:30'--等待30秒
timeout =60
------解决方案--------------------
--手动设置查询超时,可以使用以下语句: sp_configure 'show advanced options', 1 GO RECONFIGURE GO sp_configure 'query wait', 2147483647 GO RECONFIGURE GO
------解决方案--------------------
Set Conn = Server.CreateObject("ADODB.Connection") DSNtest="DRIVER={SQL Server};SERVER=ServerName;UID=USER;PWD=password;DATABASE=mydatabase" Conn. Properties("Connect Timeout") = 15 '以秒为单位 Conn.open DSNtest