如果条件在调试时保持空闲状态

时间:2013-07-16 14:18:11

标签: vb.net

调试此部分时顺利执行

 Private Sub copythat()
    '*************MOVING to hrb FROM OTK*******************

    If FORK.ComboBox1.Text = "OTK" And ListBox2.Text = "HRB" Then
        Try
            Dim strconnectionsrting = ClsFuncs.connstring("connectionstring1")
            Dim cmdin As New SqlCommand
            Dim cnnoledb As New SqlConnection
            cnnoledb.ConnectionString = strconnectionsrting
            cnnoledb.Open()
            If bsknum <> "" Then
                cmdin.CommandText = "insert into dbo.HRB_inlet([basket_id],[operator_name],[dte],[tme],[quantity],[resistance],[FLG])values('" & Label2.Text & "','" & Label3.Text & "','" & Label4.Text & "','" & Label5.Text & "','" & Label6.Text & "','" & Label7.Text & "','2')"
                'cmdin.CommandText = "insert into dbo.HRB_inlet select * from dbo.outlet where basket_id = '" & bsknum & "'"
                cmdin.CommandType = CommandType.Text
                cmdin.Connection = cnnoledb
                cmdin.ExecuteNonQuery()

                cnnoledb.Close()

            Else
                MessageBox.Show("Unable to MOVE PRODUCT", "ERROR")
            End If
            deletion()

        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try

但是当它达到以下ELSEIF语句时,程序不会做任何事情。

  'FROM STR 31 TO TESTBAY
  ElseIf FORK.ComboBox1.Text = "31 STR" And ListBox2.Text = "TESTBAY" Then
            Try
                Dim strconnectionsrting = ClsFuncs.connstring("connectionstring1")
                Dim cmdrd As New SqlCommand
                Dim cnnoledb As New SqlConnection
                cnnoledb.ConnectionString = strconnectionsrting
                cnnoledb.Open()
                cmdrd.CommandText = "INSERT into testbay select *  from dbo.str31 where str31.outlet_packaging_id in (select outlet_packaging_id from str31 where outlet_packaging_id = '" & bsknum & "')"
                cmdrd.CommandType = CommandType.Text
                cmdrd.Connection = cnnoledb
                cmdrd.ExecuteNonQuery()
                cnnoledb.Close()
                deletion()
            Catch ex As Exception
                MessageBox.Show(ex.Message)
            End Try
endif

我对VB很陌生,所以非常感谢任何帮助。

0 个答案:

没有答案