以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  计划管理疑惑2  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=71562)

--  作者:雁过不留痕8
--  发布时间:2015/7/14 9:08:00
--  计划管理疑惑2
设定一个计划任务“计划1”,没有时间间隔,在需要的时候开启\'MyTimers("计划1").Enabled=true,在计划1完成后\'MyTimers("计划1").Enabled=False

那“计划1”的属性,应该怎样设置呢,间隔设置为多少,执行为false还是true,允许暂停设置为false 还是true?

我的计划1的代码如下,相同的代码,在窗口的button里面不报错,但是计划管理代码报错,望高人指教
Dim s(100) As String
Dim n,m As Integer
Dim drs As List(Of DataRow)
drs = DataTables("扫描枪记录").Select("")

For Each dr As DataRow In drs
If dr("顺序")<>""
s(n) =dr("扫描表号")
n=n+1
End If
Next
Dim t1 As WinForm.TextBox = Forms("包装统计系统").Controls("TextBox1")
Dim t4 As WinForm.TextBox = Forms("包装统计系统").Controls("TextBox4")
Dim cmd As New SQLCommand
Dim dt As DataTable
cmd.C
Dim cmd1 As New SQLCommand
Dim dt1 As DataTable
cmd1.C
cmd1.CommandText = "SELECT *  F rom " & "{" & t1.text & t4.text & "表号信息" & "}"
dt1=cmd1.ExecuteReader(True)
Dim drOrder1 As DataRow


Dim bjlxString As String \'表计类型三相表或单相表
\'If(t1.text.substring(0,1)="D")Then
bjlxString="单相表"
\'Else If(t1.text.substring(0,1)="S")Then
\'bjlxString="三相表"
\'End If
Dim d1 As Date=Date.now()
Dim d2 As Date = New Date(d1.Year, d1.Month, d1.Day, 0, 0, 0)
Dim d3 As Date = New Date(d1.Year,d1.Month, d1.Day, 23, 59, 59)

Dim year As Integer = d1.Year
Dim month As Integer = d1.Month
Dim monthstring As String=cstr(month)
Dim yearstring As String=cstr(year)
If(monthstring.length=1)Then
m + monthstring
End If

For m=0 To n-1 
cmd.CommandText = "SELECT * F rom " & "{" & "单相表出厂参数检查数据表" & yearstring & monthstring & "} W HERE " & "[操作时间]>=\'" & d2 & "\' And [操作时间]<=\'" & d3 & "\' and [铭牌条码]=\'"& s(m) & "\'"
dt = cmd.ExecuteReader()
drOrder1 = dt1.Find("表号 = \'" & s(m) & "\'") 
If dt.DataRows.count>0 Then
drOrder1("CCJ")="1"
Else 
drOrder1("CCJ")="0"

End If
dt1.Save()
Next
\'MyTimers("计划1").Enabled=False




--  作者:大红袍
--  发布时间:2015/7/14 9:35:00
--  

这句,写在最前面 MyTimers("计划1").Enabled=False

 

间隔尽量设置大一些,几秒的样子;

 

自动执行设置成False。