怪事:谁能说说这是什么原因?
lurel 2003-10-17 09:37:23 Public Sub ConnectToDataBase()
'On Error GoTo HandleErr
Set ADOtj = New ADODB.Connection
With ADOtj
.Provider = "SQLOLEDB.1"
.Properties("Data Source").Value = "."
.Properties("Initial Catalog").Value = "tj"
.Properties("User ID").Value = "sa"
.Open
End With
End Sub
Public Function openqueryrecordset(sqlstring As String) As Boolean
Set ADOqry = New ADODB.Recordset
ADOqry.Open sqlstring, ADOtj
'If ADOqry.EOF = True And ADOqry.BOF = True Then
' openqueryrecordset = True
'Else
' openqueryrecordset = False
' End If
End Function
Public Sub CloseRecordset()
ADOqry.Close
Set ADOqry = Nothing
End Sub
Public Sub DisconnectFromDataBase()
ADOtj.Close
Set ADOtj = Nothing
End Sub
其中ADOqry,ADOtj在另一个模块中声明
Public ADOtj As ADODB.Connection
Public ADOqry As ADODB.Recordset
ado我也引用了
为什么在编译的时候告诉我在ADOqry.Close这行"对象变量或with块变量未设置"