该如何实现啊,有现成的VB脚本吗,或者相关资料
问题补充:
是这样的,我的WINCC装在服务器电脑上,服务器有两个网口,一个网口连接我们的PLC(1513F),另外一个网口连接对方服务器(ORACLE),这两边的以太网IP不在同一网段。现在我需要读取对方ORACLE数据库里的信息到我PLC程序,再反馈值给对方数据库,该如何操作,有没有相关经验的。
钻石用户推荐最佳答案
Option Explicit
Function action
On Error Resume Next
Dim sCon
Dim sSql
Dim conn
Dim wSB1,wSB2,wHOB
sCon="Provider=SQLOLEDB.1;Password=123;Persist Security Info=True;User ID=sa;Initial Catalog=SH;Data Source=192.168.0.10"
Set conn = CreateObject("ADODB.Connection")
conn.ConnectionString = sCon
conn.Open
wSB1= HMIRuntime.Tags("AT-P-01/AT.In11#Value").Read
wSB2= HMIRuntime.Tags("AT-P-01/AT.In12#Value").Read
wHOB= HMIRuntime.Tags("AT-P-01/AT.In13#Value").Read
''Msgbox wSB1
sSql = "INSERT INTO Power (SteamBoiler_1,SteamBoiler_2,HotOilBoiler) VALUES" & _
" (" & wSB1 & "," & wSB2 & "," & wHOB & ");"
conn.execute sSql
conn.Close
End Function
提问者对于答案的评价:
原创文章,作者:ximenziask,如若转载,请注明出处:https://www.zhaoplc.com/plc363787.html