สอบถามเรื่อง VB.NET หน่อยครับ ??

พอดีผมเลองเขียน คือจะให้เเจ้งเตือนว่า Order Not found, Please check again.
แต่คราวนี้มันเข้าเเจ้งเตือนตลอด คือปกติถ้าไม่มีก็ให้แจ้งเตือน

#vb #sql
โค้ดจริง
If Me.cobOrder.Text <> "" Then

            cnn.Open()
            'sql = "SELECT * FROM vewPlanList_StandardTime WHERE (I_SEIBAN = '" & cobOrder.Text & "')"

            sql = "SELECT Production_Order FROM Close_Production_Order WHERE (Production_Order = '" & Me.cobOrder.Text & "')"

            command = New SqlCommand(sql, cnn)
            Dim sqlReader As SqlDataReader = command.ExecuteReader()

            If sqlReader.HasRows Then
             MsgBox("Already close order , can't start", vbCritical + vbOKOnly)
             icheck = 1
             cnn.Close()
             Me.cobOrder.Text = ""
             'Me.cobLineName.Text = ""
             'Me.cobOperator.Text = ""
             Me.lblItemCode.Text = ""
             Me.lblItemDesc.Text = ""
             Me.lbHour.Text = "00"
             Me.lbMinute.Text = "00"
             Me.lbSecond.Text = "00"
             Me.lblQty.Text = "0"

             Me.btStart.Enabled = False
             Me.btStop.Enabled = False
             Me.btAdd.Enabled = False
             Me.btRemove.Enabled = False
             Me.btCloseOrder.Enabled = False

             lblQty.Text = 0
             lblQty.BackColor = Color.Black
             sProduction_Order = ""
             sResult_All = 0

            ElseIf sqlReader.HasRows = False Then

             MsgBox("Order Not found, Please check again", vbCritical + vbOKOnly)

             Me.cobOrder.Text = ""
             'Me.cobLineName.Text = ""
             'Me.cobOperator.Text = ""
             Me.lblItemCode.Text = ""
             Me.lblItemDesc.Text = ""
             Me.lbHour.Text = "00"
             Me.lbMinute.Text = "00"
             Me.lbSecond.Text = "00"
             Me.lblQty.Text = "0"

             Me.btStart.Enabled = False
             Me.btStop.Enabled = False
             Me.btAdd.Enabled = False
             Me.btRemove.Enabled = False
             Me.btCloseOrder.Enabled = False

             lblQty.Text = 0
             lblQty.BackColor = Color.Black
             sProduction_Order = ""
             sResult_All = 0

            Else
             icheck = 0
             Me.btStart.Enabled = False
             Me.btStop.Enabled = False

             Me.btAdd.Enabled = False
             Me.btRemove.Enabled = False
             Me.btCloseOrder.Enabled = True
             'Me.btStart.BackColor = Color.SeaGreen
             'Me.btStop.BackColor = Color.IndianRed

            End If

            cnn.Close()
        Else

            cnn.Close()
        End If
แก้ไขข้อความเมื่อ
แสดงความคิดเห็น
โปรดศึกษาและยอมรับนโยบายข้อมูลส่วนบุคคลก่อนเริ่มใช้งาน อ่านเพิ่มเติมได้ที่นี่