我不知道这段代码,因为如果条件为真,msgbox 会出现,但如果条件为假,msgbox 不会出现。任何人都可以给出一些想法。这是代码
Dim cnnOLEDB As New OleDbConnection(strConnectionString)
sql = "SELECT * FROM Spec WHERE Category='1BK' IN ( Silo = '" & txtBin.Text & "' AND WheatType = '" & ddlType.Text & "')"
cmd = New OleDbCommand(sql, cnnOLEDB)
cnnOLEDB.Open()
Dim dr As OleDbDataReader
dr = cmd.ExecuteReader()
'If dt.Rows.Count > 0 Then
While dr.Read()
If ddlType.Text = dr("WheatType") Then
MsgBox("OK")
Else
MsgBox("Wrong")
End If
End While