麻豆一区区三三四区产品麻豆-麻豆影视国产TV在线观看-麻豆影视国产在线观看-麻豆影视在线-麻豆影视在线观看av-麻豆影院

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)的緣故呢?

主站蜘蛛池模板: 2024最新四虎免费| 国产乱子伦在线一区二区| 午夜精品久久久久久久久久久久| 激情久久av一区av二区av三| 亚洲精品一区二区三区免| 亚洲成人影院在线观看| 国产色播| 男人天堂2018亚洲男人天堂| 久久99国产亚洲高清观看首页| 国语对白精品视频在线观看| 亚洲国产成人资源在线观看| 国产制服丝袜你懂的| 一级特黄录像免费播放中文版| 在线不卡免费视频| 国产无码乱伦自拍| 少妇做爰又色又紧夜视频| 欧美一区二区三区导航| 91麻豆福利| 亚洲欧美激情图片| 国产成人香蕉在线视频fuz| 国产麻豆放荡AV剧情演绎| 精品视频一区二区三三区四区| 在线观看精品自拍视频| 欧美日韩国产在线人成 | 亚洲成人国产精品无码果冻| 国产v综合v亚洲欧美久久| 免费亚洲成人| 国产无套露脸在线观看| 日日摸夜夜添夜夜添久久| 欧美日韩国产亚洲图片成人网 | 中文字幕免费不卡二区| 亚洲精品久久久久久无码AV| 国产成人av每日更新| 久久久久久久免费| 国产欧美成人| 四房播播最新网址| 青青草原亚洲精品视频| 2024久久久高清456免费在线观看 2024久久久高清456详情在线观看 | 国产乱子伦一级毛片| 国产一性一交一伦一A片| 精品国产四虎影视|