使用vbs程序
Dim ObjConnection
Dim ObjCommand
Dim amount
Set ObjConnection = CreateObject("ADODB.Connection")
Set ObjCommand = CreateObject("ADODB.Command")
ObjConnection.ConnectionTimeout=2000
ObjConnection.ConnectionString= "DRIVER = {Microsoft Access Driver (*.mdb,*.accdb)};DBQ = F:\amount.accdb"
ObjConnection.open
If ObjConnection.State=adStateOpen Then
amount=1
Else
amount=0
End If
HMIRuntime.Tags("adress").write amount
With ObjCommand
ActiveConnection=ObjConnection
CommandText="INSERT INTO 表1 (name.count) values ('余厚祥',25)"
End With
ObjConnand.Execute
判断连接成功与否的程序好像跟本没有执行,更不用说插入数据了。我用的是ACCESS2013,ODBC配置好了,系统windows7,不知道有什么不对的地方
最佳答案
应该是你的ConnectionString有问题,建议你用odbc链接mdb数据库,然后wincc链接odbc。
提问者对于答案的评价:
试试看
原创文章,作者:more0621,如若转载,请注明出处:https://www.zhaoplc.com/plc191467.html