99久久国产综合精品女不卡-99久久好看一级毛片-99久久精品99999久久-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中為什么卻完全讀不出來歸檔數(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)的緣故呢?

主站蜘蛛池模板: 成年人黄网站| www日韩在线| 亚洲黄色片在线观看| 欧美在线一区视频| 国产乱人乱精一区二区视频密| 黑人巨大在线| zoofilia杂交videos新一| 久久精品国产线看观看亚洲| 香蕉视频在线免费| 亚洲综合图片| 91精品啪在线观看国产色| 久久国产精品亚洲综合| 中文字幕极速在线观看| 亚洲黄色在线视频| 成人看片毛片免费播放器| 欧美一级网址| 欧美色图在线观看| 国产三级a三级三级野外| 国产精品一区二区三| 高清免费a级在线观看国产| 91免费视| 99视频精品免费99在线| 国产精品成人免费视频不卡| 国产亚洲综合成人91精品| 久久青草免费91线频观看不卡| 欧美亚洲免费| 日韩无套| 日本欧美成| 日韩欧美第一页| 色爱综合区| 日韩一页| 手机看片久久高清国产日韩| 亚洲加勒比久久88色综合1| 亚洲欧美另类视频| 亚洲综合丁香婷婷六月香| 一区精品麻豆入口| 在线亚洲日产一区二区| 521色香蕉网在线观看免费| 91大神大战酒店翘臀美女| 1a级毛片免费观看| 在线看欧美日韩中文字幕|