永发信息网

提示下边越界,怎么修改才行呢

答案:2  悬赏:80  手机版
解决时间 2021-02-22 02:51
  • 提问者网友:心如荒岛囚我终老
  • 2021-02-21 13:20
Private Sub LoadHouse()
Dim n As Integer
Dim n As Integer

For n = MSFlexGrid1.Rows - 1 To 2 Step -1

MSFlexGrid1.RemoveItem (n)

Next

Dim str As String
If m_kind = "全部" Then

str = "select * from 客房信息表 order by 客房ID"
Else
str = "select * from 客房信息表 where 类型 ='" & m_kind & "'order by 客房ID "

End If

Dim myrs As ADODB.Recordset
Set myrs = New ADODB.Recordset

myrs.CursorLocation = adUseClient
myrs.LockType = adLockOptimistic
myrs.CursorType = adOpenDynamic
myrs.Open str, cnn
myrs.MoveFirst

Dim m_sum As Integer '读取共多少条记录

m_sum = myrs.RecordCount
MSFlexGrid1.Rows = MSFlexGrid1.Rows + m_sum - 1

Dim m As Integer

For m = 1 To m_sum

MSFlexGrid1.TextMatrix(m, 1) = myrs("用户名")
MSFlexGrid1.TextMatrix(m, 2) = myrs("职位")
MSFlexGrid1.TextMatrix(m, 3) = myrs("密码")

myrs.MoveNext

Next

End Sub
最佳答案
  • 五星知识达人网友:往事隔山水
  • 2021-02-21 13:33
一定是列或行数多与数据库里的列值.
数据库第一列为0列.第二列才是1...依次类推...
全部回答
  • 1楼网友:琴狂剑也妄
  • 2021-02-21 13:58
我。。知。。道 加。。我。。私。。聊
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯