我的代码似乎表现得我不明白。有时它会按预期返回 null ,有时它会在它应该为 null 时返回一个值。有人怎么解释这个?这是从访问中选择并在消息框中显示结果的代码:
cmd5.Connection = cnn
cmd5.CommandText = "SELECT receipt_num " & _
"FROM brought_coffee, farmer where crop_year= " & yr & " and " & _
"brought_date=#" & dtt & "# and farmer_centre='" & ctr & _
"' and farmer.farmer_num=brought_coffee.farmer_num"
myData5 = cmd5.ExecuteReader
While myData5.Read()
chkdb = myData5(0).ToString
End While
MsgBox("the check" & chkdb)
myData5.Close()