Why I get “System.Data.DataRowView” instead of real values in my Listbox?

前端 未结 12 823
一向
一向 2020-11-29 08:24

I\'m hoping someone can help. But whenever I run my code and try to view a highscore all I get back in my listbox is System.Data.DataRowView.

12条回答
  •  时光说笑
    2020-11-29 09:14

    The following code should work:

    DataSet dSet = new DataSet();
    dAdapter.Fill(dSet);
    
    lstNames.DisplayMember = "NameAndScore";
    lstNames.ValueMember = "NameAndScore";
    lstNames.DataSource = dSet.Tables[0];
    

    If it does not work, please update your question and provide us with some information about the columns and values that are actually returned in dSet.Tables[0].

提交回复
热议问题