I tried to retrieve data from access database. I wrote the function inside of a class and i got this error. So please anyone know an answer for this question please let me know how can i fix it. the below function is wrote in a class and i need to know how to display data to listview control by using this function and how to call it form load event. i tried to fix this lots of time and i still didn't get a solution for this.
public List<String> displayRoom()
{
List<String> rooms = new List<String>();
String query = "select * from room";
cmd = new OleDbCommand(query, connect);
reader = cmd.ExecuteReader();
while(reader.Read()){
rooms.Add(reader["buyer_name"].ToString());
rooms.Add(reader["room_type"].ToString());
rooms.Add(reader["date_from"].ToString());
rooms.Add(reader["date_to"].ToString());
}
return rooms;
}