Using conn As New MySqlConnection("server=localhost;user=root;password=;database=dbrentalsystem")
conn.Open()
Dim commandReader As New MySqlCommand("select * from tbl_unit", conn)
Dim reader As MySqlDataReader = commandReader.ExecuteReader
While reader.Read
If reader.IsDBNull(2) Then
lblUnit1.Text = "Vacant"
Else
lblUnit1.Text = "Occupied"
End If
End While
commandReader.Dispose()
reader.Close()
con.Close()
End Using
这是我的代码,我只想检查第2列第3行是否有数据
1条答案
按热度按时间fcg9iug31#
一种快速且有点脏的方法是在reader中添加count和count到3。。这不是任务的最佳解决方案,但它会起作用:)