1个回答
推荐于2016-04-04
展开全部
'请自行创建数据库连接gcnn
Dim sql As String
Dim rsTmp As New ADODB.Recordset
Dim LvItem As ListItem
‘listview名为lvArch
LvArch.ColumnHeaders.Clear
LvArch.ListItems.Clear
LvArch.View = lvwReport
LvArch.ColumnHeaders.Add , , "年份", TextWidth(Space(10))
LvArch.ColumnHeaders.Add , , "月份", TextWidth(Space(10)), lvwColumnCenter
LvArch.ColumnHeaders.Add , , "名称", TextWidth(Space(25)), lvwColumnCenter
sql = "select * from T_info"
rsTmp.Open sql, gcnn, adOpenForwardOnly, adLockOptimistic
LvArch.ListItems.Clear
While Not rsTmp.EOF
Set LvItem = LvArch.ListItems.Add(, , rsTmp!FYEAR)
With LvItem
.SubItems(1) = IIf(rsTmp!FMONTH = 0, "", rsTmp!FMONTH)
.SubItems(2) = rsTmp!ftablename
End With
rsTmp.MoveNext
Wend
rsTmp.Close
Dim sql As String
Dim rsTmp As New ADODB.Recordset
Dim LvItem As ListItem
‘listview名为lvArch
LvArch.ColumnHeaders.Clear
LvArch.ListItems.Clear
LvArch.View = lvwReport
LvArch.ColumnHeaders.Add , , "年份", TextWidth(Space(10))
LvArch.ColumnHeaders.Add , , "月份", TextWidth(Space(10)), lvwColumnCenter
LvArch.ColumnHeaders.Add , , "名称", TextWidth(Space(25)), lvwColumnCenter
sql = "select * from T_info"
rsTmp.Open sql, gcnn, adOpenForwardOnly, adLockOptimistic
LvArch.ListItems.Clear
While Not rsTmp.EOF
Set LvItem = LvArch.ListItems.Add(, , rsTmp!FYEAR)
With LvItem
.SubItems(1) = IIf(rsTmp!FMONTH = 0, "", rsTmp!FMONTH)
.SubItems(2) = rsTmp!ftablename
End With
rsTmp.MoveNext
Wend
rsTmp.Close
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询