打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
使用WinCC将数据写入ACCESS

使用WinCC将数据写入ACCESS



Introduction

In this example, tag value is written from WinCC to an Access database via an ODBC driver. The example does not contain error handling.

Procedure

1. Create the Access database with the WINCC_DATA table and (ID, TagValue) columns with the ID as the Auto Value.

2. Set up the ODBC data source with the name "SampleDSN" reference to the above Access database.

3. Programming.

Example

'VBS108

Dim objConnection

Dim strConnectionString

Dim lngValue

Dim strSQL

Dim objCommand

strConnectionString "Provider=MSDASQL;DSN=SampleDSN;UID=;PWD=;" 

lngValue HMIRuntime.Tags("Tag1").Read

strSQL "INSERT INTO WINCC_DATA (TagValue) VALUES (" lngValue ");"  

Set objConnection CreateObject("ADODB.Connection")

objConnection.ConnectionString strConnectionString

objConnection.Open

Set objCommand CreateObject("ADODB.Command")

With objCommand

    .ActiveConnection objConnection

    .CommandText strSQL

End With

objCommand.Execute

Set objCommand Nothing

objConnection.Close

Set objConnection Nothing

wincc6.0手册里的例子,我试过好使。
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
VBS连接数据库操作
4年项目经验总结:WINCC都不会,谈什么月薪过万?
三层架构C/S程序设计实例(C#描述)
Wincc VBS操作txt及SQL2005
ASP.NET快速学习
vb登录界面设计笔记(连接SQLServer2000数据库)
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服