运行时错误 3709 连接无法。。。在上下文。。。
Dim cn As ADODB.Connection
Dim SqlStr As String, CnStr As String
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
CnStr = "Provider=sqloledb;server=abc;user id=sa;pwd=sa;database=abc"
cn.Open CnStr
If cn.State = adStateOpen Then
MsgBox "数据库连接成功!"
End If
SQL = "select * from TT where NUM<>0"
rs.Open SQL
。。。。。
提示错误3709,为什么呢?之前提示了 数据库连接成功!"
[解决办法]
SQL = "select * from TT where NUM<>0"
rs.Open SQL,cn,adopenkeyset,adlockreadonly
[解决办法]
http://download.csdn.net/source/1498324