我有一个组合框cbAnalytes:
cbAnalytes.DataSource = ConnectandReadList(qcvalues_query);
ConnectandReadList的位置是:
public DataTable ConnectandReadList(string query) { DataTable ds = new DataTable(); string connection_string = "Data Source=hermes;database=qcvalues; Integrated Security=SSPI;"; using (var myConnection = new SqlConnection(connection_string)) { myConnection.Open(); var command = new SqlCommand(query, myConnection); var adapter = new SqlDataAdapter(command); adapter.Fill(ds); } return ds; }
由于某种原因,它填充组合框:
System.Data.DataRowView System.Data.DataRowView System.Data.DataRowView System.Data.DataRowView System.Data.DataRowView
有谁知道我做错了什么?
你在设置你的属性DisplayMember
和ValueMember
属性是什么?您需要为组合框设置这些属性,以便它知道要显示的内容.