Office中国论坛/Access中国论坛
标题:
ADP连接请教朱大哥
[打印本页]
作者:
yodong
时间:
2011-12-27 15:57
标题:
ADP连接请教朱大哥
sqlconn = "SQLOLEDB.1
ASSWORD=" & password1 & "
ERSIST SECURITY INFO=FALSE;USER ID=" & sa1 & ";INITIAL CATALOG=" & data1 & ";DATA SOURCE=" & source1 & ";Network Library=dbmssocn"
Public Function sCreateConnection(ByVal udlFileName As String) As Boolean
On Error GoTo sCreateConnectionTrap:
Dim sConnectionString As String
sConnectionString = "
rovider=" & udlFileName
Application.CurrentProject.OpenConnection sConnectionString
Application.CurrentProject.Connection.ConnectionTimeout = 300'设置超时.
sCreateConnection = True
sCreateConnectionExit:
Exit Function
sCreateConnectionTrap:
sCreateConnection = False
MsgBox Err.Description, vbInformation, sysstr
Resume sCreateConnectionExit
End Function
=======================
为什么这句通不过Application.CurrentProject.Connection.ConnectionTimeout = 300'设置超时.
作者:
zhuyiwen
时间:
2011-12-27 19:07
因为 CurrentProject.Connection 是只读对象
你要在sConnectionString中设置TimeOut
sqlconn = "SQLOLEDB.1;PASSWORD=" & password1 & ";PERSIST SECURITY INFO=FALSE;USER ID=" & sa1 & ";INITIAL CATALOG=" & data1 & ";DATA SOURCE=" & source1 & ";Network Library=dbmssocn" & ";Connect Timeout=500"
复制代码
作者:
yodong
时间:
2011-12-30 09:27
哦.这样.我试试.谢谢朱大哥.
欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/)
Powered by Discuz! X3.3