我试图从表中的一列获得更多的值。我的表非常简单:
public class MensajeTablon
{
[PrimaryKey]
public int id { get; set; }
public int identificadorUsuario { get; set; }
public string nombre { get; set; }
public string mensaje { get; set; }
public string foto { get; set; }
public DateTime fecha { get; set; }
public int identificadorTablon { get; set; }
}
现在我的表中有2行,ID为1,一行ID为2。当我尝试查询时,它返回一个ID = 0的对象。我不明白为什么。我的查询是:
var idMensaje = dbConn.Query<MensajeTablon>("select MAX(id) from MensajeTablon;");
我确信我有这两行,如果我读表(从MensajeTablon中选择 *),我会得到这两行。
1条答案
按热度按时间bogh5gae1#
我知道的唯一方法是创建一个类来镜像结果。所以
现在
idMensaje[0].id
是您的最大值var
existing
是我的查询结果