I want to display the route names inside in my combo box from a local access database but I get this error and I don't know why. I tried a lot of stuff that I found online but none of them helped.
Maybe there is something wrong with the code?
private void Form1_Load(object sender, EventArgs e)
{
OleDbConnection connection = new OleDbConnection();
//Connection string:
connection.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=E:\Programming\Job\Jaratok.accdb;Persist Security Info=False;";
connection.Open();
OleDbCommand command = new OleDbCommand();
command.Connection = connection;
string query = "SELECT Name FROM Route";
command.CommandText = query;
OleDbDataReader reader = command.ExecuteReader();
while (reader.Read())
{
comboBox1.Items.Add(reader["Name"].ToString());
}
connection.Close();
So as you can see, the database is there, in the folder but still...