Foxtable(狐表)用户栏目专家坐堂 → [求助]两段代码各只能执行1次,再点击无效


  共有2050人关注过本帖树形打印复制链接

主题:[求助]两段代码各只能执行1次,再点击无效

帅哥哟,离线,有人找我吗?
xndd
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:二尾狐 帖子:537 积分:4465 威望:0 精华:0 注册:2014/11/26 15:23:00
[求助]两段代码各只能执行1次,再点击无效  发帖心情 Post By:2018/7/31 11:13:00 [显示全部帖子]

 我做了一个select的case,里面有可以正常执行的代码,但是交替点击后,再次点击任意一个都无效了,什么情况?

代码:
S elect Case e.Link.Text
    Case "查询品号公用属性"
      
        Dim tb1 As WinForm.Table = e.Form.Controls("Table1")
        Dim cmd As New SQLCommand
        cmd.C
        cmd.CommandText = "S ELECT FEATURE_ID AS [ID], FEATURE_CODE AS [属性编号], FEATURE_NAME AS [属性名称], " & _
        " CASE DATA_TYPE WHEN 1 THEN '字符型' WHEN 2 THEN '数值型' END AS [数据类型]," & _
        " DATA_SIZE AS [数据长度], CASE USE_METHOD WHEN 1 THEN '列举' WHEN 2 THEN '按区间设置' WHEN 3 THEN '不限制' WHEN 4 THEN '自动编码' END AS [取值方式]," & _
        " CASE CODE_LENGTH_CONTROL WHEN 0 THEN '不需要' WHEN 1 THEN '需要' END AS [纳入编码长度需一致]," & _
        " CASE ApproveStatus WHEN 'Y' THEN '生效' WHEN 'N' THEN '失效' END AS [单据状态属性]" & _
        " f rom dbo.FEATURE " & _
        " ORDER BY FEATURE_CODE ASC "
        tb1.Table.DataSource  = cmd.ExecuteReader()
        '统计数量
        Dim val1 As Integer
        Dim cmd1 As New SQLCommand
        cmd1.C
        cmd1.CommandText = "S ELECT count(1) f rom dbo.FEATURE "
      
        val1 = cmd1.ExecuteScalar()
      
        Dim tl1 As WinForm.TopicLink
        tl1 = Forms("品号检查窗口").Controls("TopicBar1").pages("品号查询").Links("查询品号公用属性")
        tl1.Text = "查询品号公用属性:" & val1
      
        e.form.controls("Table1").Table.DataTable.load
      
    Case "尚未建立采购信息的品号"
      
        Dim tb2 As WinForm.Table = e.Form.Controls("Table1")
        Dim cmd As New SQLCommand
        cmd.C
        cmd.CommandText = "S ELECT ITEM_BUSINESS_ID AS [主键], ITEM_CODE AS [品号], ITEM_NAME AS [品名], ITEM_SPECIFICATION AS [规格] " & _
        "f rom dbo.ITEM " & _
        "WHERE ITEM_BUSINESS_ID NOT In (S elect ITEM_ID f rom dbo.ITEM_PURCHASE) And  " & _
        "      ITEM_BUSINESS_ID NOT In (S elect ITEM_ID f rom dbo.ITEM_PLANT WHERE ITEM_PROPERTY = 'M') AND " & _
        "      ITEM_BUSINESS_ID NOT In (S elect ITEM_BUSINESS_ID f rom dbo.ITEM WHERE ITEM_CODE Like '3%') AND " & _
        "         ITEM_BUSINESS_ID NOT IN (S elect ITEM_BUSINESS_ID f rom dbo.ITEM WHERE ITEM_CODE LIKE '4%') " & _
        "ORDER BY ITEM_CODE ASC "
        tb2.Table.DataSource  = cmd.ExecuteReader()
      
        '统计数量
        Dim val2 As Integer
        Dim cmd2 As New SQLCommand
        cmd2.C
        cmd2.CommandText = "S ELECT count(1) " & _
        "f rom dbo.ITEM " & _
        "WHERE ITEM_BUSINESS_ID NOT In (S elect ITEM_ID f rom dbo.ITEM_PURCHASE) And  " & _
        "      ITEM_BUSINESS_ID NOT In (S elect ITEM_ID f rom dbo.ITEM_PLANT WHERE ITEM_PROPERTY = 'M') AND " & _
        "      ITEM_BUSINESS_ID NOT In (S elect ITEM_BUSINESS_ID f rom dbo.ITEM WHERE ITEM_CODE Like '3%') AND " & _
        "         ITEM_BUSINESS_ID NOT IN (S elect ITEM_BUSINESS_ID f rom dbo.ITEM WHERE ITEM_CODE LIKE '4%') "
      
        val2 = cmd2.ExecuteScalar()
      
        Dim tl2 As WinForm.TopicLink
        tl2 = Forms("品号检查窗口").Controls("TopicBar1").pages("品号检查").Links("尚未建立采购信息的品号")
        tl2.Text = "尚未建立采购信息的品号:" & val2
      
        e.form.controls("Table1").Table.DataTable.load
    Case "删除"
      
      
    Case "主页"
      
End S elect





 回到顶部
帅哥哟,离线,有人找我吗?
xndd
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:二尾狐 帖子:537 积分:4465 威望:0 精华:0 注册:2014/11/26 15:23:00
  发帖心情 Post By:2018/7/31 11:15:00 [显示全部帖子]


图片点击可在新窗口打开查看此主题相关图片如下:111111111111111.png
图片点击可在新窗口打开查看

就是第一个和最后一个
相互点击后,再点击就无效了

 回到顶部
帅哥哟,离线,有人找我吗?
xndd
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:二尾狐 帖子:537 积分:4465 威望:0 精华:0 注册:2014/11/26 15:23:00
  发帖心情 Post By:2018/7/31 12:23:00 [显示全部帖子]

懂了,谢谢!

 回到顶部