我正在尝试让记分牌从 mySQL DB 显示在我的列表框中。
但是我在列表框中得到的只是'System.Data.DataRowView'
这是代码:
MySqlConnection myConn = new MySqlConnection(connStr);
string sqlStr = "SELECT CONCAT(Name, ' ', Score) as NameAndScore " + "FROM highscore ORDER BY Score DESC";
MySqlDataAdapter dAdapter = new MySqlDataAdapter(sqlStr, myConn);
DataTable dTable = new DataTable();
lstNames.DisplayMember = "NameAndScore";
lstNames.DataSource = dTable;
dAdapter.Fill(dTable);
dAdapter.Dispose();