I'm consulting a database of Mysql and I want to show the result in DatagridView
my problem is that I display the date with the time and I just need the date I tried with
.ToString("dd/MM/yyyy")
and
.ToShortDateString()
but it returns the following error in execution.
LINQ to Entities does not recognize the 'System.String' method ToString (System.String) 'of the method, and this method can not be translate into a warehouse expression.
this is my code.
TEntities db = new TEntities();
var reporte = from consul in db.Transaccion
where consul.Cliente_idCliente == idCli
select new { Codigo = consul.idTransaccion,
Fecha = consul.fecha.ToString("dd/MM/yyyy"),
Valor = consul.valor,
otra = consul.denominacion + " " +
consul.noAutorizacion
};
dataGridView1.DataSource = reporte.ToList() ;