0

调试时这部分执行顺利

 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 很陌生,所以任何帮助都将不胜感激。

4

0 回答 0