gpt4 book ai didi

asp.net - 字段列表中名为 '' 的字段不明确

转载 作者:行者123 更新时间:2023-11-30 23:20:27 25 4
gpt4 key购买 nike

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

最佳答案

chamadosprioridades 表都有一个名为prioridade 的字段。因此,您不能将该字段名称用作 SELECT 语句中的别名。

尝试 pri.prioridade AS prioridad 或类似的东西。

关于asp.net - 字段列表中名为 '' 的字段不明确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15750992/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com