0
System.Data.DataRowView只显示在组合框中,而不是Project.xlsx的Sheet1中的“pmName”。另外,在添加DisplayMember或ValueMember时,会出现错误,说明属性不存在。从Excel表C中填充组合框#
public void LoadCustomerCombo3()
{
try
{
using (OleDbConnection conn = new OleDbConnection(constr_xls))
{
conn.Open();
string strSql = "SELECT pmName FROM [Sheet1$]";
OleDbDataAdapter adapter = new OleDbDataAdapter(new OleDbCommand(strSql, conn));
DataSet ds = new DataSet();
adapter.Fill(ds);
testCombo.ItemsSource = ds.Tables[0].DefaultView;
conn.Close();
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
谢谢......但没有帮助我的问题。我已经收到确切数量的“System.Data.DataRowView”作为组合框中的项目数。 – nextCode