wincc 报表问题

wincc归档压缩数据怎样读取  做报表用

最佳答案

Dim oRs 
Dim conn 
Dim oCom 

sCon ="Provider=SQLOLEDB.1;"&_
"Integrated Security=SSPI;"&_
"Persist Security InfO=False;"&_
"Initial CataloG=CC_fortest_10_08_22_10_02_39R;"&_
"Data SourcE=.\WinCC"

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

 sSql_1="Tag:R,”Archive1\tag1”,”2012-9-29 10:00:00”,”2012-9-29 12:00:00”"
oCom.CommandText = sSql_1
Set oRs=oCom.Execute
      oRs.MoveFirst
msgbox oRs.Fields(2).Value
以上脚本是读取归档Archive1中,变量tag1从10点到12点的数据,然后弹出读取到的第一个数据值,因为从10点到12点会读取到很多数据,将以上脚本做修改,你可以查询任何时刻的归档数据。

提问者对于答案的评价:
谢谢

原创文章,作者:more0621,如若转载,请注明出处:https://www.zhaoplc.com/plc196690.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2017年8月24日
下一篇 2017年8月24日

相关推荐