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

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

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

主站蜘蛛池模板: 免费lulu网站| 1769亚洲资源站365在线| 国产色综合久久五月色婷婷中文| 久久综合中文字幕佐佐木希| 呜嗯啊野战h呻吟男男双性| 国产极品久久| 蜜臀91| 免费视频左左视频| 国产精品第2页| 好吊色青青青国产综合在线观看| 亚洲精品一区二区三区在线观看| 5g996未满十八| 久久综合久综合久久鬼色| 美国高清xxxxx18| 亚洲精品一区在线观看 | 91短视频社区在线观看| 卫生间被教官做好爽HH视频| α片免费| 久久久久九九| 99热网址| 免费国产之a视频| 四虎网站最新网址| gay18高中生白袜xnxx动漫| ffee性xxⅹ另类老妇hd| 四虎欧美| 日韩中文字幕一区| 射玉足| 色综合中文字幕天天在线| 调教麻麻成贱m| 国产精品第2页| 国产在线欧美日韩精品一区二区| bl双性肉文| 男人狂擦女人的下面视频| 色老板成人永久免费视频| 男人的天堂久久| 俄罗斯精品bbw| 精品无人区乱码1区2区3区免费| 波多野结衣女老师| 国产日韩精品一区二区| 亚洲精品国产成人中文| 免费观看美女被cao视频|