您的位置:首页 > 编程语言 > VB

VB 利用时间控件过站

2012-03-17 05:25 204 查看
使用SQL无源连接,须先点 工程 菜单 选择 引用 然后勾选Microsoft ActiveX Data Objects 2.8 Library和Microsoft ActiveX Data Objects Recordset 2.8 Library

Dim db As New ADODB.Connection

Dim rs As New ADODB.Recordset

Dim sql As String
Dim c As Integer
Dim d As Integer
Dim b As String
Private Sub Form_Load()
db.Open "Provider=SQLOLEDB.1;Password=123;Persist Security Info=True;User ID=sa;Initial

Catalog=DATABASENAME;Data Source=192.172.0.2"
End Sub

Private Sub Timer1_Timer()
c = c + 1
If c Mod 60 = 0 Then
d = d + 1
rs.Open "update mes_sn set fnextterminalid=1098 where fworkorderno='m3112039405' and fnextterminalid=1097 and

fcurrentterminalid=1099", db
b = Str(d)
Label1.Caption = "已经执行第" + b + "次"
End If
End Sub本文出自 “liaoliaome” 博客,请务必保留此出处http://ghostsoul.blog.51cto.com/436356/808338
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: