万老师:
我向通过在WINCC下给SQL SERVER 中的表wincc_data的字段TagValue写一值,怎么实现不了。
能帮我看看下面的程序吗?
通过ODBC DRIVER 写到SQL SERVER 数据库,strConnctionString怎么设置?
谢谢!
Dim objConnection
Dim strConnctionString
Dim lngValue
Dim strSQL
Dim objCommand
strConnectionString ="Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=master;Data Source=WORK1"
Value=HMIRuntime.Tags ("tag1").Read
strSQL="insert into wincc_data(TagValue) values ("&lngValue&");"
Set objConnetion=Creatobject("ADODB.Connetion")
objConnetion.ConnectionString=strConnectionString
objConnection.open
Set objConnetion=Creatobject("ADODB.Command")
With objCommand
.ActiveConnection=objConetion
.CommandText=strSQL
End With
objCommand.Close
setobjConnection=Nothing