Help! I am trying to fill a listbox with items from my database with the sql statement, I'm unsure how to fix this error as it keeps coming up. My database only contains two dates, but I need it to be expandable in future, hence the database to store dates.
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()
The error 'Cannot bind to the new display member' occurs on the
lbxDates.ValueMember = "ShowDate" line