我的代码出了什么问题?对于Funcionario表和Projeto表,下划线为红色......
DataContext db = new projfuncionarioDataContext();
var query = from p in db.Funcionario
join c in db.Projeto on p.Cdfunc equals c.Cdfunc
select new
{
ID = p.Cdfunc,
Produto = p.Nome,
};
GridView1.DataSource = query;
GridView1.DataBind();
答案 0 :(得分:7)
DataContext db = new projfuncionarioDataContext();
应该是:
projfuncionarioDataContext db = new projfuncionarioDataContext();
答案 1 :(得分:0)
尝试:
GridView1.DataSource = query.ToList();
答案 2 :(得分:0)
您的GridView是否有AutoGeneratedColumns property set?