99久久国产综合精品女不卡-99久久好看一级毛片-99久久精品99999久久-99久久精品费精品国产-99久久精品费精品国产一区二

yuantao0615
級別: 探索解密
精華主題: 0
發帖數量: 73 個
工控威望: 186 點
下載積分: 696 分
在線時間: 45(小時)
注冊時間: 2010-01-04
最后登錄: 2015-12-14
查看yuantao0615的 主題 / 回貼
樓主  發表于: 2013-10-15 17:21
這段代碼在WINCC6.2中可以讀出歸檔數據,在WINCC7.0中為什么卻完全讀不出來歸檔數據呢?
求高手指導。。。〖奔保。。。。!

Dim sPro, sDsn, sSer, sCon, sSql
    Dim conn, oRs, oCom
    Dim DSNName
    Dim i As Integer
    Dim sStart, sStop As String
    
Sub get_wincc_data()

    '--Get Database DSN name-----------------------------------
    Set DSNName = CreateObject("CCHMIRuntime.HMIRuntime")
    sDsn = DSNName.Tags("@DatasourceNameRT").Read
    
    '--build connection string-----------------------------------
    sPro = "Provider=WinCCOLEDBProvider.1;"
    sDsn = "Catalog=" & sDsn & ";"
    sSer = "Data Source=ZHANG\WinCC"
    sCon = sPro & sDsn & sSer
    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
    
  
    sStart = Year(DTPicker1.Value) & "-" & Month(DTPicker1.Value) & "-" & Day(DTPicker1.Value) & " 00:00:00"
    sStop = Year(DTPicker1.Value) & "-" & Month(DTPicker1.Value) & "-" & Day(DTPicker1.Value) & " 23:00:00"
    
  
     sStart = DateAdd("h", -8, CDate(sStart))
     sStop = DateAdd("h", -8, CDate(sStop))
    
  
     sSql = "Tag:R,('ProcessValueArchive\Fan1_T1'),'" & sStart & "','" & sStop & "' order by datetime"
     oCom.CommandText = sSql
    Set oRs = oCom.Execute
    If (oRs.EOF) Then
       oRs.Close
    Else
        oRs.MoveFirst
        i = 0
        Do While Not oRs.EOF
        Sheet1.Cells(i + 4, 2) = oRs.Fields("RealValue").Value
        oRs.MoveNext
        i = i + 1
        Loop
        oRs.Close
    End If
  

    sSql = "Tag:R,('ProcessValueArchive\Fan1_T2'),'" & sStart & "','" & sStop & "' order by datetime"
    oCom.CommandText = sSql
    Set oRs = oCom.Execute
    If (oRs.EOF) Then
       oRs.Close
    Else
        oRs.MoveFirst
        i = 0
        Do While Not oRs.EOF
        Sheet1.Cells(i + 4, 3) = oRs.Fields("RealValue").Value
        oRs.MoveNext
        i = i + 1
        Loop
        oRs.Close
    End If

    sSql = "Tag:R,('ProcessValueArchive\Fan1_P1'),'" & sStart & "','" & sStop & "' order by datetime"
    oCom.CommandText = sSql
    Set oRs = oCom.Execute
    If (oRs.EOF) Then
        oRs.Close
    Else
        oRs.MoveFirst
        i = 0
        Do While Not oRs.EOF
        Sheet1.Cells(i + 4, 4) = oRs.Fields("RealValue").Value
        oRs.MoveNext
        i = i + 1
        Loop
        oRs.Close
    End If
    
  
    sSql = "Tag:R,('ProcessValueArchive\Fan1_P2 '),'" & sStart & "','" & sStop & "' order by datetime"
    oCom.CommandText = sSql
    Set oRs = oCom.Execute
  
    If (oRs.EOF) Then
       oRs.Close
    Else
        oRs.MoveFirst
        i = 0
        Do While Not oRs.EOF
        Sheet1.Cells(i + 4, 5) = oRs.Fields("RealValue").Value
        oRs.MoveNext
        i = i + 1
        Loop
        oRs.Close
    End If
    
Set oRs = Nothing
Set conn = Nothing
End Sub


Private Sub DTPicker1_Change()
clear_cell get_wincc_data
End Sub

Sub clear_cell()
For i = 4 To 27
  For j = 2 To 5
  Cells(i, j) = ""
  Next j
Next i
End Sub
yuantao0615
級別: 探索解密
精華主題: 0
發帖數量: 73 個
工控威望: 186 點
下載積分: 696 分
在線時間: 45(小時)
注冊時間: 2010-01-04
最后登錄: 2015-12-14
查看yuantao0615的 主題 / 回貼
1樓  發表于: 2013-10-15 23:08
是不是因為ConnectivityPack沒有授權的緣故呢?

主站蜘蛛池模板: 成人做爰免视频高清| 一区二区三区免费视频 www| 免费a大片| 国产一级特黄aa大片高清| 黄色片网站在线| 成人国产精品免费视频| 精品老司机在线视频香蕉| 日韩精品一区二三区中文| 亚洲色图综合区| 91麻豆视频在线| 久久66热re国产毛片基地| 中文字幕日产乱码偷在线| 在线观看高清视频bbixx| 免费看污的网站| 欧美精品亚洲精品日韩一区| 国产美女在线精品观看| 香蕉在线观看999| 深夜成人性视频免费看| 99青青草| 福利国产精品| 国产成人午夜精品免费视频| 激情啪啪网| 久久久综合久久| 欧美成人免费午夜全| 日韩一区二区久久久久久| 亚洲国产成人手机在线电影bd| 777在线视频| 96国产精品| bt国产| 一级全免费视频播放| 艹逼视频免费| 久久久99精品免费观看精品| 日本一级作爱片在线观看| 日韩字幕在线| 亚洲一区国产| 亚洲区一二三四区2021| 亚洲精品女同一区二区三区| 成 黄 色 激 情视频网站| 成人黄色小视频在线观看| 成年人免费网站在线观看| 成年女人毛片免费视频|