I’m trying to read from an access database and put the results in a listbox. Here is the code I have, it keeps telling me that “No data exists for the row/column. I have data entered in a Column named “GroupName” and have data in a column named “RandomNumber” in the table “GroupNames”
db = new OleDbConnection();
db.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data source=" + fileName;
db.Open();
string sql = "SELECT * FROM GroupNames ORDER BY RandomNumber ASC";
cmd = new OleDbCommand(sql, db);
rdr = cmd.ExecuteReader();
lblist.Text = (string)rdr["GroupName"];
Try this: