0
幫助!我想用sql語句填充數據庫項目的列表框,我不確定如何解決這個錯誤,因爲它不斷出現。我的數據庫只包含兩個日期,但我需要它在未來可擴展,因此數據庫存儲日期。錯誤! - 無法綁定到新的顯示成員
Public ds As New DataSet
Public con As New OleDb.OleDbConnection 'used to connect to the database
Public provider As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source ="
Public datafile As String = "Resources/database.accdb" 'database location and version
Public da As OleDb.OleDbDataAdapter
Public sqlstatement As String
ds.Clear()
con.ConnectionString = connString
con.Open()
sqlstatement = "SELECT ShowDate FROM AvailableDates"
da = New OleDb.OleDbDataAdapter(sqlstatement, con)
da.Fill(ds, "Dates")
lbxDates.DisplayMember = "ShowDate"
lbxDates.DataSource = ds
lbxDates.ValueMember = "ShowDate"
con.Close()
錯誤「無法綁定到新的顯示成員」發生在
lbxDates.ValueMember = "ShowDate" line
方式你沒有標記答案是如何解決你的問題? http://stackoverflow.com/questions/37187867/error-object-reference-not-set-to-an-instance-of-an-object#37187867 –
對不起,我該怎麼做? – chandler
在答案的左邊你會找到一個圖標標記,點擊它,謝謝 –