vb 对象变量或with块变量未设置
来源:百度知道 编辑:UC知道 时间:2024/09/24 23:30:03
Private Sub ShowData()
Dim j As Integer
Dim i As Integer
Dim MsgText As String
Set mrc = ExecuteSQL(txtSQL, MsgText)
With msgList
.Rows = 1
Do While Not mrc.EOF
.Rows = .Rows + 1
For i = 1 To mrc.Fields.Count
If Not IsNull(Trim(mrc.Fields(i - 1))) Then
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
End If
Next i
mrc.MoveNext
Loop
End With
mrc.Close
End Sub
你好 请问下我上面的代码错在了呢??怎么改呢?
Dim j As Integer
Dim i As Integer
Dim MsgText As String
Set mrc = ExecuteSQL(txtSQL, MsgText)
With msgList
.Rows = 1
Do While Not mrc.EOF
.Rows = .Rows + 1
For i = 1 To mrc.Fields.Count
If Not IsNull(Trim(mrc.Fields(i - 1))) Then
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
End If
Next i
mrc.MoveNext
Loop
End With
mrc.Close
End Sub
你好 请问下我上面的代码错在了呢??怎么改呢?
这里:
mrc.MoveNext
改成
If Not mrc.EOF() Then mrc.MoveNext
还有,最好是判断下mrc.RecordCount的值,后面的mrc.close也最好是这样写法比较安全:
If Not (mrc Is Nothing) Then
If mrc.State = adStateOpen Then mrc.Close:set mrc=Nothing
End If
VB 对象变量或with块变量未设置
VB中对象变量或with块变量错误(91号错误)
vb 实时错误‘91’对象变量或 With 块变量没有设置
对象变量或WITH块变量未设置
对象变量或with块变量未设置 在vb程序设计中,出现这个问题是为什么啊
我运行VB程序时出现实时错误‘91’ 对象变量或with块变量未设置
vb+SQL做一个登录界面,报错"对象变量或With块变量未设置"
为什么 实时错误'91': 对象变量或With块变量未设置
实时错误'91'对象变量或with块变量未设置(在线等)
VB里面连access报“对象变量或with块变量没有设置”怎么解决?详细点好么?我菜得可以~~