惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

腾讯CDC
Engineering at Meta
Engineering at Meta
Last Week in AI
Last Week in AI
V
Visual Studio Blog
Stack Overflow Blog
Stack Overflow Blog
A
About on SuperTechFans
博客园 - 司徒正美
D
DataBreaches.Net
有赞技术团队
有赞技术团队
T
The Blog of Author Tim Ferriss
MyScale Blog
MyScale Blog
I
InfoQ
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
月光博客
月光博客
Google DeepMind News
Google DeepMind News
Recent Announcements
Recent Announcements
小众软件
小众软件
G
Google Developers Blog
博客园 - 【当耐特】
U
Unit 42
美团技术团队
B
Blog
D
Docker
Blog — PlanetScale
Blog — PlanetScale

博客园 - 徐一贺

java将读取到的西门子PLC中标签的二进制数组,根据标签数据类型,偏移长度解析其真实的值。 java读取西门子PLC标签为二进制的时根据标签数据类型传入二进制数组长度的判断。 Windows Server 与 Windows 10/11 官方安装系列号 WPF控件拖拽 从域名到IP地址:nslookup命令带你开启网络之旅 全国DNS服务器地址列举 Win系统端口被占用怎么办?解决方案就在这,速看! 博图VBS修改SQLServer数据 C# 多点最小二乘法拟合平面算法 ping某个范围的IP地址 Android Studio 2021.3.1 阿里云盘分享地址 将WPF发布为exe安装包 C#中 一个多线程框架 程序员正确使用百度的方式 关于com.google.gson.JsonSyntaxException时间格式解析错误问题 SQL Server 查询数据库表结构 国内加速访问Github的办法,超级简单 全球IP地址查询网站 Halcon2019软件安装教程 转载自:https://blog.csdn.net/cashmood/article/details/105081705 SQL Server 跨服务器视图 idea快速开发插件 比较两个库的表信息
博图VBS连接SQLServer
徐一贺 · 2022-04-23 · via 博客园 - 徐一贺

Sub VBFunction_Setting()
'提示:
' 1. 使用 <CTRL+SPACE> 或 <CTRL+I> 快捷键打开含所有对象和函数的列表
' 2. 使用 HMI Runtime 对象写入代码。
' 示例:HmiRuntime.Screens("Screen_1")。
' 3. 使用 <CTRL+J> 快捷键创建对象引用。
'从此位置起写入代码:
If SmartTags("IsLoadSettingVal") = True Then
Dim conn '定义类对象
Dim SCon '定义数据库连接字符串
Dim oRs1 '定义获取到的数据集
Dim oCom
Dim strSQL1
Dim Datetime,Count,Power
'---------打开数据库 -----------'
SCon= "Provider=SQLOLEDB; Integrated Security =SSPI;Persist Security Info=True;Initial Catalog=PlanCheck;Data Source=DESKTOP-OCMKPGO;uid=sa;pwd=password"
Set conn=CreateObject("ADODB.Connection")
conn.ConnectionString = SCon
conn.CursorLocation = 3
conn.Open
Set oRs1 = CreateObject("ADODB.Recordset")
Set oCom = CreateObject("ADODB.Command")
oCom.CommandType = 1

'读取误差值
strSQL1 = "SELECT id,iItem_name,item_value FROM setting WHERE iItem_name = 'error_val'"
Set oCom.ActiveConnection = conn
oCom.CommandText = strSQL1
Set oRs1 = oCom.Execute
SmartTags("ErrorVal") = oRs1.fields("item_value").value

'读取A面Z的设定值
Dim oRsAZ
oCom.CommandText = "SELECT id,iItem_name,item_value FROM setting WHERE iItem_name LIKE 'A_Z%' ORDER BY iItem_name ASC"
Set oRsAZ = CreateObject("ADODB.Recordset")
Set oRsAZ = oCom.Execute
Dim dataCount
dataCount = oRsAZ.RecordCount
oRsAZ.movefirst
Dim index
For index = 1 To dataCount
Dim tagName
tagName = "A_Z"&index
SmartTags(tagName) = oRsAZ.fields("item_value").value
oRsAZ.movenext
Next

'读取B面Y的设定值
Dim oRsBY
oCom.CommandText = "SELECT id,iItem_name,item_value FROM setting WHERE iItem_name LIKE 'B_Y%' ORDER BY iItem_name ASC"
Set oRsBY = CreateObject("ADODB.Recordset")
Set oRsBY = oCom.Execute
dataCount = oRsBY.RecordCount
oRsBY.movefirst
For index = 1 To dataCount
tagName = "B_Y"&index
SmartTags(tagName) = oRsBY.fields("item_value").value
oRsBY.movenext
Next

'读取C面Y的设定值
Dim oRsCY
oCom.CommandText = "SELECT id,iItem_name,item_value FROM setting WHERE iItem_name LIKE 'C_Y%' ORDER BY iItem_name ASC"
Set oRsCY = CreateObject("ADODB.Recordset")
Set oRsCY = oCom.Execute
dataCount = oRsCY.RecordCount
oRsCY.movefirst
For index = 1 To dataCount
tagName = "C_Y"&index
SmartTags(tagName) = oRsCY.fields("item_value").value
oRsCY.movenext
Next

'读取D面Z的设定值
Dim oRsDZ
oCom.CommandText = "SELECT id,iItem_name,item_value FROM setting WHERE iItem_name LIKE 'D_Z%' ORDER BY iItem_name ASC"
Set oRsDZ = CreateObject("ADODB.Recordset")
Set oRsDZ = oCom.Execute
dataCount = oRsDZ.RecordCount
oRsDZ.movefirst
For index = 1 To dataCount
tagName = "D_Z"&index
SmartTags(tagName) = oRsDZ.fields("item_value").value
oRsDZ.movenext
Next

'---------关闭数据库-----------'
Set oRsAZ = Nothing
Set oRsBY = Nothing
Set oRsCY = Nothing
Set oRsDZ = Nothing
Set oRs1 = Nothing
Set oCom = Nothing
conn.Close
Set conn = Nothing
SmartTags("IsLoadSettingVal") = False
End If
End Sub