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