-- 作者:xndd
-- 发布时间:2018/7/31 11:13:00
-- [求助]两段代码各只能执行1次,再点击无效
我做了一个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
|