wincc如何导出报警记录中的消息,并显示在监控画面上

wincc如何导出报警记录中的消息,并显示在监控画面上,第1张

你打开报警归档的数据库的table 看看各个字段 按照需求读取
这是我写的 读取报警归档之后 将归档值写入内部变量的例子
Dim sPro
Dim sDsn
Dim sSer
Dim sCon
Dim sSql
Dim conn
Dim oRs
Dim oCom
Dim oItem
'Dim m,n,s
'connection string
sPro = "Provider=WinCCOLEDBProvider1;"
sDsn = "Catalog=CC_GDSmartP_12_03_10_08_18_49R;" '数据库名
sSer = "Data Source=\WinCC"
sCon = sPro + sDsn + sSer
'sCon="Provider=WinCCOLEDBProvider1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=SSEJRecord;Data Source=\WINCC"
'MsgBox "set sCon"
'sSQL为查询命令
sSql = "ALARMVIEW:Select FROM AlgViewCht WHERE MsgNr=1"
'sSql = "ALARMVIEW:SELECT from AlgViewChs"
'MsgBox "Set SQL"
'建立连接
Set conn = CreateObject("ADODBConnection")
connConnectionString = sCon
connCursorLocation = 3
connOpen
'MsgBox "conn Open"
'进行查询
Set oRs = CreateObject("ADODBRecordset")
Set oCom = CreateObject("ADODBCommand")
oComCommandType = 1
Set oComActiveConnection = conn
oComCommandText = sSql
'MsgBox "set command"
'填充记录集
Set oRs = oComExecute
'm = oRsFieldsCount
MsgBox oRsEOF
If(oRsEOF) Then
oRsClose
Else
oRsMoveFirst
Do While Not oRsEOF
HMIRuntimeTags("AlarmText1")Write CStr(oRsFields(17)Value)
HMIRuntimeTags("AlarmText2")Write CStr(oRsFields(18)Value)
HMIRuntimeTags("AlarmText3")Write CStr(oRsFields(19)Value)
HMIRuntimeTags("AlarmText4")Write CStr(oRsFields(20)Value)
HMIRuntimeTags("AlarmText5")Write CStr(oRsFields(21)Value)
HMIRuntimeTags("AlarmText6")Write CStr(oRsFields(22)Value)
HMIRuntimeTags("AlarmText7")Write CStr(oRsFields(23)Value)
oRsMoveNext
Loop
oRsClose
End If
Set oRs = Nothing
connClose
Set conn = Nothing


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/yw/13255422.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-06-27
下一篇 2023-06-27

发表评论

登录后才能评论

评论列表(0条)

保存