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

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沒有授權的緣故呢?

主站蜘蛛池模板: 大杳蕉伊人狼人久久一本线| 成人ww| 国产精品一区三区| 波多野结衣在线观看3人| 国产成人精品自拍| 另类二区| 精品免费看| 久久99精品国产麻豆婷婷| 成人国产综合| 久久精品免视着国产成人| 久久精品视频大全| 国产精品30p| 毛片1毛片2毛片3毛片4| 免费a级在线观看完整片| 黄色片在线播放| 国产亚洲精品网站| 久久亚洲精品玖玖玖玖| 免费一级毛片在线播放视频 | 国产video| 美女一区二区在线观看| 精品日韩一区二区三区| 播放一级录像片| 大学生一级毛片免费看真人| 麻豆国产精品入口免费观看| 国产一级视频久久| 国产成人精品综合久久久软件| 毛片视频网站在线观看| 精品久久一| 老外一级毛片| 国产ts| 久久se精品动漫一区二区三区 | 国产剧情麻豆精品免费| 九九九九九在线精品区| 国产精品美女久久久久久| 福利在线免费| 国产福利影院| 国产精品综合网| 精品三级网站| 韩国特色特黄特刺激的毛片 | 国产成人免费在线视频| 国产精品系列在线一区|