Skip navigation links

MySQL Forums :: Connector/NET and C#, Mono, .Net :: Unknown column 'Distinct1.nCdSite' in 'where clause'


Advanced Search

Unknown column 'Distinct1.nCdSite' in 'where clause'
Posted by: Fabricio famadori ()
Date: February 26, 2013 06:00PM

Good evening, I'm two days trying to solve this problem and got nothing. I am suspicious that it is a bug, could someone help me? I am getting the following error message.

Unknown column 'Distinct1.nCdSite' in 'where clause'

[MySqlException (0x80004005): Unknown column 'Distinct1.nCdSite' in 'where clause']
MySql.Data.MySqlClient.MySqlStream.ReadPacket() +501
MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow, Int64& insertedId) +450
MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId, Boolean force) +136
MySql.Data.MySqlClient.MySqlDataReader.NextResult() +1269
MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior) +2528
MySql.Data.Entity.EFMySqlCommand.ExecuteDbDataReader(CommandBehavior behavior) +22
.
.
.

I have the following code

[Table("pagina")]
public class pagina
{
[Key]
public long nCdPagina { get; set; }
public long nCdVisitante { get; set; }
public string sDsUrlReferencia { get; set; }
public string sDsPalavraChave { get; set; }
public string sDsTitulo { get; set; }

[ForeignKey("nCdVisitante")]
public visitante visitante { get; set; }
}

public class retorno
{
public long Key { get; set; }
public int Online { get; set; }
}

[Table("site")]
public class site
{
[Key]
public long nCdSite { get; set; }
public string sDsTitulo { get; set; }
public string sDsUrl { get; set; }
public DateTime tDtCadastro { get; set; }
}
}

[Table("visitante")]
public class visitante
{
[Key]
public long nCdVisitante { get; set; }
public long nCdSite { get; set; }
public string sDsIp { get; set; }
public DateTime tDtCadastro { get; set; }
public DateTime tDtAtualizacao { get; set; }

[ForeignKey("nCdSite")]
public site site { get; set; }
}


return (from pag in this.context.pagina.Include("visitante").Include("site")
group pag by pag.visitante.nCdSite into g
select new retorno
{
Key = g.Key,
Online = g.Select(e => e.visitante.sDsIp).Distinct().Count()
}).ToList<retorno>();

The problem only occurs when I place. Distinct (). Count () if let alone. Count () works perfectly.

Help please

Options: ReplyQuote


Subject Written By Posted
Unknown column 'Distinct1.nCdSite' in 'where clause' Fabricio famadori 02/26/2013 06:00PM
Re: Unknown column 'Distinct1.nCdSite' in 'where clause' Fernando Gonzalez.Sanchez 02/27/2013 05:43PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.