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

yuantao0615
級(jí)別: 探索解密
精華主題: 0
發(fā)帖數(shù)量: 73 個(gè)
工控威望: 186 點(diǎn)
下載積分: 696 分
在線時(shí)間: 45(小時(shí))
注冊(cè)時(shí)間: 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
級(jí)別: 探索解密
精華主題: 0
發(fā)帖數(shù)量: 73 個(gè)
工控威望: 186 點(diǎn)
下載積分: 696 分
在線時(shí)間: 45(小時(shí))
注冊(cè)時(shí)間: 2010-01-04
最后登錄: 2015-12-14
查看yuantao0615的 主題 / 回貼
1樓  發(fā)表于: 2013-10-15 23:08
是不是因?yàn)镃onnectivityPack沒有授權(quán)的緣故呢?

主站蜘蛛池模板: 高清国产激情视频在线观看| 成人综合婷婷国产精品久久免费| 免费高清在线| bl双性受乖调教改造身体| 特黄特色大片免费视频播放| 亚洲一区二区成人| 国产caonila在线观看| 亚洲欧洲日产v特级毛片| 精品久久久久久亚洲| 欧美大b| 国产亚洲女在线线精品| caoporn草棚在线视频| 欧美大片一区二区| 亚洲国产精品高清在线| 国产精品3p视频| 亚洲精品视频在线| 亚洲日日操| 无人区尖叫之夜美女姐姐视频| 成年极品漫画在线观看| 亚洲第一人黄所| 全彩成人18h漫画| 国产探花在线观看| 2021精品国夜夜天天拍拍| 欧美日韩第二页| 亚洲国产一区二区a毛片| 九草视频在线| 精品国产乱码久久久久久软件| 视频在线精品| 男人含玉势出嫁束器| 日本护士撒尿| 成人免费观看www视频| 韩国美女主播在线| 亚洲天堂中文| 性欧美xxxxxxx另类| 单亲乱l仑在线观看免费观看| 国色天香社区在线视频免费观看| 69人成网站色www| 男同桌扒开女同桌胸罩喝奶 | 亚洲一区二区成人| 国产亚洲欧美在线中文bt天堂网| 鬼吹灯天星术在线高清观看|