以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  循环问题  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=184697)

--  作者:朱女士
--  发布时间:2022/12/23 15:48:00
--  循环问题

老师您好!

 

我在窗口中添加了三个表控件,想输入三个不同的项目号,分别依次在三个表中显示不同的内容,我写的代码,如果输入三个项目号,就跳过第二个窗口table,在第3个里显示数据,然后报错找不到第4个窗口table。不知道我循环错在哪里,谢谢!

Dim b1 As WinForm.TextBox = e.Form.Controls("TextBox1")
Dim value As String = b1.value
Dim Names() As String = Value.Split(chr(13))
Dim dt As DataTable
Dim cmd As New SQLCommand
cmd.C
cmd.CommandText = "S elect [_Identify],上一工序,项目号 From {项目进度计算表} Wh ere 清单条码编码 is not null" \'注意要包括主键列
dt = cmd.ExecuteReader(True) \'注意可选参数设置为True
Dim v As String
 Dim n As Integer = 0
 
For Each name As String In Names
  n = n + 1
   name = name.replace(chr(10), "")
   name = trim(name)

    v = Str(n)
    Dim xx As String = "Table" & Trim(v)
 
    Tables("项目工序进度提示屏_" & xx & "").fill("S elect [_identify],[序号],[上一工序],[项目号],[产品名称] F rom {项目进度计算表} where 项目号=\'" & name & "\'", "沃德车间数据", True) 
    cmd.ExecuteNonQuery()
   
    DataTables ("项目进度计算表").Load()
  
Next


--  作者:有点蓝
--  发布时间:2022/12/23 16:30:00
--  
Dim b1 As WinForm.TextBox = e.Form.Controls("TextBox1")
Dim value As String = b1.value
Dim Names() As String = Value.replace(vbcr).Split(vblf)
for i as integer = 0 to Names.length - 1
Tables("项目工序进度提示屏_" & (i+1)).fill("Select [_identify],[序号],[上一工序],[项目号],[产品名称] F rom {项目进度计算表} where 项目号=\'" & Names(i) & "\'", "沃德车间数据", True) 
next