Dim DNRT,DSN
Dim con,conn,oRs,oCom,sSQL
Dim con1,conn1,oRs1,oCom1,sSQL1
Dim BH
Dim rc
Dim i
DNRT = HMIRuntime.Tags("@DatasourceNameRT").Read
BH = ScreenItems("bianhao").InputValue
con= "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog="&DNRT&";Data Source=.\wincc"
Set conn= CreateObject("ADODB.Connection")
conn.ConnectionString=con
conn.CursorLocation=3
conn.Open
Set oRs=CreateObject("ADODB.Recordset")
Set oCom= CreateObject("ADODB.Command")
Set oCom.ActiveConnection=conn
oCom.CommandType=1
sSQL="SELECT DSN FROM AMT WHERE AppName='ALG' "
oCom.CommandText=sSQL
Set oRS=oCom.Execute
rc=oRS.RecordCount
oRS.movefirst
For i = 1 To rc
DSN=oRs.fields(0).Value
con1= "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog="&DSN&";Data Source=.\wincc"
Set conn1= CreateObject("ADODB.Connection")
conn1.ConnectionString=con1
conn1.CursorLocation=3
conn1.Open
Set oRs1=CreateObject("ADODB.Recordset")
Set oCom1= CreateObject("ADODB.Command")
Set oCom1.ActiveConnection=conn1
oCom1.CommandType=1
sSQL1="DELETE FROM [MsArcLong] WHERE MsgNr = "&BH
oCom1.CommandText=sSQL1
Set oRS1=oCom1.Execute
Set oRS1=Nothing
oRS.movenext
Next
Set oRS=oCom.Execute
Set oRS=Nothing
conn.close
Set conn=Nothing
conn1.close
Set conn1=Nothing
Msgbox("对应编号报警已经删除,重新打开此画面查看。")
版权属于:
滕招
作品采用:
《
署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)
》许可协议授权
评论 (0)