I'm trying to retrieve data from database and display it in a listbox. I've got the following code and when I run it, it gives no error or something but no data is showing up in the listbox.
connection.Open();
DataTable dt = new DataTable();
OleDbCommand command = new OleDbCommand();
command.Connection = connection;
command.CommandText = "select * from Appointments where PersonID = '" + textBox4.Text + "'";
OleDbDataReader reader = command.ExecuteReader();
dt.Load(reader);
foreach (DataRow Dr in dt.Rows)
{
listBox1.Items.Add(Dr["PersonID"].ToString());
}
connection.Close();