思思久久96热在精品国产10-思思久久96热在精品国产免费-思思久久99-思思久久99热-一级毛片免费观看视频-一级毛片免费看

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中為什么卻完全讀不出來(lái)歸檔數(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沒(méi)有授權(quán)的緣故呢?

主站蜘蛛池模板: 国产成人综合精品一区| 国产一区二区三区不卡免费观看| 国产精品免费福利| 久久www免费人成_看片高清| 女18一级大黄毛片免费女人| 岛国片在线播放| 麻豆国产一区| 不卡的在线视频免费观看| 牛牛影视精品一区二区在线看| 看中国真人一级毛片| 播放一级片| 搞黄视频网站| 国产精品亚洲国产三区| 黄色一级视频网| 岛国片免费在线观看| 国产一级簧片| 九九九免费视频| 九草视频| 国产精品一区欧美激情| 久久99精品综合国产首页| 国产成人精品久久一区二区三区| 成人a视频| 老司机狠狠k免费毛片| 国内精品七七久久影院| 国产麻豆91欧美一区二区| 成人三级在线| 黄色a毛片| 韩国三级视频网站| 久久国产精品国产自线拍免费 | 国产的一级毛片完整| 免费国产午夜在线观看| 老司机日日摸夜夜摸精品影院| 国产三级网页| 国产精品98福利小视频| 欧美1级| 久久亚洲精品中文字幕二区| 国产精品国产三级国产在线观看| 国产精品久久久久久福利| 国产a视频精品免费观看| 久久精品94精品久久精品动漫 | 国产精品喷水在线观看|