一区二区三区成人-一区二区三区www-一区二区三区 日韩-一区二区日韩欧美-一区二区日韩精品中文字幕-一区二区日韩

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

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
發(fā)帖數(shù)量: 73 個
工控威望: 186 點
下載積分: 696 分
在線時間: 45(小時)
注冊時間: 2010-01-04
最后登錄: 2015-12-14
查看yuantao0615的 主題 / 回貼
1樓  發(fā)表于: 2013-10-15 23:08
是不是因為ConnectivityPack沒有授權(quán)的緣故呢?

主站蜘蛛池模板: 美女撒尿无遮挡免费中国| 添逼逼视频| 久久五月综合婷婷中文云霸高清| 日本高清中文字幕一区二区三区| 国产精品2| spy2wc48美女撒尿| 日韩欧美一区二区在线观看| 国产小情侣自拍| 国产日韩欧美综合在线| 日韩精品一区二区| 欧美一区二区三区成人看不卡| 国产精品久久久久一区二区三区| 久久99国产视频| 男人猛进猛出女人下面视频 | 99国产高清久久久久久网站| 日韩欧美亚洲一区二区综合 | 女毛片| 欧美视频一区二区三区四区| 99热综合在线| 国产自拍啪啪| 性柔术18性13处交| 免费观看无人区完整版| a一级毛片录像带 录像片| 国产高清专区| 成人免费毛片一区二区三区| 亚洲欧美日韩综合在线播放| 美女毛片老太婆bbb80岁| 草草线在成年免费视频网站| chinesespanking网站| 亚洲激情欧美| 欧美ⅹxxxx视频| 亚洲午夜精品久久久久久成年| 乌克兰xxxxx| 激情小说欧美图片| 久久er国产免费精品| 精品无码一区在线观看| 亚洲成人黄色网址| 免费α片| 四虎免费看片| 69成人影院| 亚洲天堂岛国片|