我在我的項目中使用2 gridview
,我將員工綁定在一個網格上,我想在第二個網格上顯示每個員工的訂單。我被卡在過濾其他員工,當我點擊顯示訂單按鈕時,它顯示我所有的訂單,我如何指向正確的索引(員工選擇)? 。如何將gridview綁定到另一個網格視圖?
我的代碼:
private void Form3_Load(object sender, EventArgs e)
{
using (NorthWindDataContext db = new NorthWindDataContext())
{
var query =
from d in db.Employees
select new
{
d.FirstName
};
dataGridView1.DataSource = query;
}
}
private void displayOrdersToolStripMenuItem_Click(object sender, EventArgs e)
{
using (NorthWindDataContext db = new NorthWindDataContext())
{
var query =
from o in db.Orders
select new
{
o.ShipName <----problem here :(
};
dataGridView2.DataSource = query;
}
}
請幫
感謝
什麼是錯誤的異常? – spajce 2013-02-17 06:55:07