string sql = @"
SELECT
sit.descricao AS situacao,
pri.prioridade AS prioridade,
usr.nome AS responsavel,
ch.previsao_termino AS previsao,
ch.descricao AS descricao,
clb.clube,
proj.descricao AS projeto,
func.descricao AS funcionalidade
FROM
chamados AS ch
LEFT JOIN
prioridades AS pri
ON
ch.prioridade = pri.id
INNER JOIN
situacoes AS sit
ON
ch.situacao = sit.id
LEFT JOIN
usuarios AS usr
ON
ch.responsavel = usr.id
INNER JOIN
clubes AS clb
ON
ch.clube = clb.id
INNER JOIN
projetos AS proj
ON
ch.projeto = proj.id
INNER JOIN
funcionalidades AS func
ON
ch.funcionalidade = func.id
WHERE
ch.id = @id";
MySqlCommand cmd = new MySqlCommand();
cmd.CommandText = sql;
cmd.CommandType = CommandType.Text;
cmd.Parameters.Add(new MySqlParameter("@id", MySqlDbType.Int32)).Value = _ch.ID;
DataSet retorno = _dal.Consultar(cmd);
return retorno;
当它返回时它不是空的,但是当我这样做时:
GridView1.DataSource(retorno);
GridView1.DataBind(); //Here Fires the error.
它会触发标题上的错误。我读了很多其他已经在这里打开的主题,但我看不出它在哪里模棱两可。是我的查询吗?或者可能是别的东西......它正在工作,然后我再次调试,错误被触发......
错误:
a field named 'prioridade' on field list is ambiguous