请问如何将adoRS的每条记录赋值到MSFLEXGRID的每行里?
rsLeased.Open sQry, cnConn, adOpenKeyset, adLockPessimistic
a = rsLeased.RecordCount
If rsLeased.RecordCount = 0 Then
MsgBox "没有符合条件的记录!", , "警告"
Exit Sub
Else
rsLeased.MoveFirst
With Record.QueryRS
.FormatString = "马号|马主|租约起始日期|租约终止日期|马薄中显示的中文名|马薄中显示的英文名|租赁费用|彩衣|彩衣1"
.Cols = 10
.Rows = a
For iRow = 0 To a .Col = 0
.Text = rsLeased.Fields(0) .Col = 1
.Text = rsLeased.Fields(2) .Col = 2
.Text = rsLeased.Fields(3) .Col = 3
.Text = rsLeased.Fields(4) .Col = 4
.Text = rsLeased.Fields(5) .Col = 5
.Text = rsLeased.Fields(6) .Col = 6
.Text = rsLeased.Fields(7) .Col = 7
.Text = rsLeased.Fields(8) .Col = 8
.Text = rsLeased.Fields(9)
If .Row + 1 < .Rows Then
.Row = .Row + 1
End If
rsLeased.MoveNext
Next iRow
End With
Record.Show
rsLeased.Open sQry, cnConn, adOpenKeyset, adLockPessimistic
a = rsLeased.RecordCount
If rsLeased.RecordCount = 0 Then
MsgBox "没有符合条件的记录!", , "警告"
Exit Sub
Else
rsLeased.MoveFirst
With Record.QueryRS
.FormatString = "马号|马主|租约起始日期|租约终止日期|马薄中显示的中文名|马薄中显示的英文名|租赁费用|彩衣|彩衣1"
.Cols = 10
.Rows = a
For iRow = 0 To a .Col = 0
.Text = rsLeased.Fields(0) .Col = 1
.Text = rsLeased.Fields(2) .Col = 2
.Text = rsLeased.Fields(3) .Col = 3
.Text = rsLeased.Fields(4) .Col = 4
.Text = rsLeased.Fields(5) .Col = 5
.Text = rsLeased.Fields(6) .Col = 6
.Text = rsLeased.Fields(7) .Col = 7
.Text = rsLeased.Fields(8) .Col = 8
.Text = rsLeased.Fields(9)
If .Row + 1 < .Rows Then
.Row = .Row + 1
End If
rsLeased.MoveNext
Next iRow
End With
Record.Show
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货