listview控件问题求助

已锁定

因为追求,所以卓越

  • 帖子

    11
  • 精华

    0
  • 被关注

    1

论坛等级:新手

注册时间:2009-06-03

普通 普通 如何晋级?

listview控件问题求助

477

6

2009-07-16 23:24:37

现在我已经利用OLEDB读出了归档数据,但怎么样把结果集显示在画面里呢,用的什么控件呢?看到示例中大都用到listview控件,它的全名是什么啊。我的系统里只有一个叫Microsoft listview control 6.0 (sp6),添加到画面里是一个白板,是这个吗?
给个WINCC控制listview的实例好吗?我用了好几个代码,没有反应,困扰了老长时间了。您看我的代码有什么问题吗?它只能显示出一个时间来,就没有反应了。
Sub OnLButtonDown(ByVal Item, ByVal Flags, ByVal x, ByVal y)
Dim sPro
Dim sDsn
Dim sSer
Dim sCon
Dim sSql
Dim oRs
Dim conn
Dim oCom
Dim oItem
Dim m, n, s,i
Dim oList


sPro = "Provider=WinCCOLEDBProvider.1;"
sDsn = "Catalog=CC_tanks_09_07_14_10_38_56R;"
sSer = "Data Source=.\WinCC"
sCon = sPro + sDsn + sSer
sSql = "TAG:R,'tanks\aa','2009-07-16 00:00:00','2009-07-17 00:00:00'"
MsgBox "Open with:" & vbCr & sCon & vbCr & sSql & vbCr
Set conn = CreateObject("ADODB.Connection")
conn.ConnectionString = sCon
conn.CursorLocation = 3
conn.Open
Set oRs = CreateObject("ADODB.Recordset")
Set oCom = CreateObject("ADODB.Command")
oCom.CommandType = 1
Set oCom.ActiveConnection = conn
oCom.CommandText = sSql
Set oRs = oCom.Execute
n=oRs.RecordCount
MsgBox(n)

Set oList = ScreenItems("控件1")
oList.ListItems.Clear
If(n>0) Then
oRs.MoveFirst
MsgBox(">0")
End If
m = 0
Do While Not oRs.EOF
m = m + 1
Set oItem = oList.ListItems.Add()
oItem.Text = Left(CStr(oRs.Fields(1).Value), 23)
oItem.SubItems(1) = FormatNumber(oRs.Fields(2).Value, 4)
oItem.SubItems(2) = Hex(oRs.Fields(4).Value)
If m > 100 Then
Exit Do
Else
MsgBox(m)
End If
oRs.MoveNext
Loop
oRs.Close
Set oRs = Nothing
conn.Close
Set conn = Nothing

End Sub

listview控件问题求助 已锁定
编辑推荐: 关闭

请填写推广理由:

本版热门话题

SIMATIC WinCC / Panel

共有32573条技术帖

相关推荐

热门标签

相关帖子推荐

guzhang

恭喜,你发布的帖子

评为精华帖!

快扫描右侧二维码晒一晒吧!

再发帖或跟帖交流2条,就能晋升VIP啦!开启更多专属权限!

  • 分享

  • 只看
    楼主

top
您收到0封站内信:
×
×
信息提示
很抱歉!您所访问的页面不存在,或网址发生了变化,请稍后再试。