我2 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;
}
}
请帮忙
谢谢