标题:求改一下代碼
只看楼主
w327555162
Rank: 2
等 级:论坛游民
帖 子:45
专家分:43
注 册:2011-1-4
结帖率:85.71%
已结贴  问题点数:6 回复次数:1 
求改一下代碼
Set rs = New ADODB.Recordset
rs.Open sql, conn, 1, 3
For i = 0 To rs.Fields.Count - 1
k = rs(i).Name
Set colx = ListView1.ColumnHeaders.Add()
    colx.Text = k
    colx.Width = ListView1.Width / rs.Fields.Count
Next
ListView1.ListItems.Clear
For c = 0 To rs.Fields.Count - 1
rs.MoveFirst
Set itmx = ListView1.ListItems.Add()
j = rs(c)
itmx = j
Next
Set rs = Nothing
這個代碼查詢的結果在ListView1中顯示到到一列中去了,我要橫向到8個例中對應顯示
搜索更多相关主题的帖子: sql 
2012-01-10 10:26
风吹过b
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:贵宾
威 望:364
帖 子:4912
专家分:29900
注 册:2008-10-15
得分:6 
Dim itmx As ListItem
Set rs = New ADODB.Recordset
rs.Open sql, conn, 1, 3
For i = 0 To rs.Fields.Count - 1
k = rs(i).Name
Set colx = ListView1.ColumnHeaders.Add()
    colx.Text = k
    colx.Width = ListView1.Width / rs.Fields.Count
Next
ListView1.ListItems.Clear

Do While Not rs.EOF
rs.MoveFirst
Set itmx = ListView1.ListItems.Add()
itmx = rs(0)
For c = 1 To rs.Fields.Count - 1
j = rs(c)
itmx.SubItems(c) = j
Next
Loop
Set rs = Nothing


你再研究一下。

授人于鱼,不如授人于渔
早已停用QQ了
2012-01-10 20:54



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-359453-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.015301 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved