沈阳电视台英娜的老公:Do While Not mrc.EOF(有附加分的哦)

来源:百度文库 编辑:杭州交通信息网 时间:2024/04/30 16:27:15
我从碟上载下的VB程序运行时,有的窗口会出现错误,调试时显示在Do While Not mrc.EOF这一行,请问是什么原因来的??能修改的吗??
请高手指点!!有附加分的哦

这是其中一段代码:
'显示Grid的内容

Public Sub ShowData()
Dim j As Integer
Dim i As Integer

Set mrc = ExecuteSQL(txtSQL, MsgText)
With msgList
.Rows = 1

Do While Not mrc.EOF
.Rows = .Rows + 1
For i = 1 To mrc.Fields.Count
Select Case mrc.Fields(i - 1).Type
Case adDBDate
.TextMatrix(.Rows - 1, i) = Format(mrc.Fields(i - 1) & "", "yyyy-mm-dd")
Case Else
.TextMatrix(.Rows - 1, i) = mrc.Fields(i - 1) & ""
End Select
Next i
mrc.MoveNext
Loop

End With
mrc.Close

End Sub

注意一下,看看mrc是否实例化(也就是是否new过),还有其他的对象,我估计是这个问题