Sub OnClick(Byval Item)
Dim hrect1,hrect2,htxt1,htxt2,htxt3,htxt4,r2,k1,r1,k2,k3,tn,r4(11, 1200),hms,hs,l,htxt5,r3,k4,r( 11, 1200)
Dim htxt6
Set tn=HMIRuntime.Tags("N_Rst")
Set hms=HMIRuntime.Tags("ims")
Set hs=HMIRuntime.Tags("is")
Set hrect1=ScreenItems("rect1")
Set hrect2=ScreenItems("rect2")
Set htxt1=ScreenItems("txt1")
Set htxt2=ScreenItems("txt2")
Set htxt3=ScreenItems("txt3")
Set htxt4=ScreenItems("txt4")
Set htxt5=ScreenItems("txt5")
Set htxt6=ScreenItems("txt6")
r2=""
r3=""
htxt1.Text=hs.Read & "." & hms.Read & "%%" & Now
hrect1.BackColor=vbBlack
Dim Running_CNN,Running_RecordSet,Running_Command,Running_strSQL
Set Running_CNN = CreateObject("ADODB.Connection")
Running_CNN.ConnectionString = strConnectionString(0)
Running_CNN.CursorLocation = 3
Running_CNN.Open
Running_strSQL="select * from Table_Running where id>=" & tn.Read & "and id <1200 +" & tn.Read
'Running_strSQL="select * from Table_Running where id>=200 and id < =1400"
Set Running_RecordSet=CreateObject("ADODB.Recordset")
Set Running_Recordset=Running_CNN.execute(Running_strSQL)
k4=Running_RecordSet.RecordCount
Running_RecordSet.Movefirst
For k2=1 To 11
r3=r3 & FormatNumber(Running_RecordSet.Fields(k2+1).Value,2) & "%"
Next
htxt3.Text=r3
htxt4.Text=hs.Read & "." & hms.Read & "%%" & Now & "**" & k4
l=1
k2=0
Do While l < k4
htxt6.Text=l
Running_RecordSet.absoluteposition=l
Do While k2<11
k2=k2+1
r4(k2,l)="SX" & k2 & ".S" & l
Set r(k2,l)=HMIRuntime.Tags(r4(k2,l))
r(k2,l).Write Running_Recordset.Fields(k2+1).Value
Loop
l=l+1
Loop
Dim rt
Set rt=HMIRuntime.Tags("SX11.S1")
'r3=r3 & Running_RecordSet.Fields(0).Value & "%" & Running_RecordSet.Fields(1).Value & "%" & l
'htxt3.Text=r2
htxt5.Text=rt.Read
htxt2.Text=hs.Read & "." & hms.Read & "%%" & Now
hrect1.BackColor=vbRed
End Sub
****************************************************************************************************************
以上脚本是从运行数据库的Table_Running中取出记录,放在变量中的脚本(变量为SX1~SX11的结构变量,其中结构变量的结构为S1~S1200,即每个结构变量有1200个数据,为内部变量),运行结果显示只能取到SX1.S1~SX11.S1十一个变量,以后SX1.S2不能取到,不知为什么?请各位大侠给予指导谢谢。