0
我有這樣的查詢:檢查數據讀取器空或不是在while條件
Dim dr As SqlDataReader
Dim str As String = "SELECT DISTINCT Location_tbl.LocName, Location_tbl.Locid FROM Transaction_tbl"
Dim cmd As New SqlCommand(str, con.connect)
dr = cmd.ExecuteReader
While dr.Read
ChkdLST.Visible = True
ChkdLST.Items.Add(dr("LocName"))
End While
dr.Close()
con.disconnect()
如果讀取器包含任何數據則只有我要讓chkdlst visible..so我想檢查我的DataReader爲空或不在While dr.Read
的階段,如果包含數據,然後應該可見,否則我必須使ChkdLST.Visible = false..so我如何檢查while dr.read
是否包含數據
我會認爲這將工作(除了語法錯誤)。你是否在任何地方設置了'ChkdLST.Visible = False'? –
No sir..i never set ChkdLST.Visible = False – user2951524