Xamarin Sqlite pcl net列的最大值



我使用的是Frank A.Krueger的Sqlite net pcl Nuget的最新版本。

我需要从表AccountMasterModel中获取列AccountNumber的最大值。

我试过这个

public Task<List<int>> GetAccountMaxAsync()
{
return database.QueryAsync<int>("SELECT Max(AccountNumber) FROM [AccountMasterModel] ");
}

我把这个k方法称为

List<int> max = new List<int>();
max = await App.Database.GetAccountMaxAsync();

代码对我来说执行成功。即使我在AccountNumber列中有值23和54,我也总是在max中得到值0。实际上我需要在max中获得54,但我只得到0。这里需要帮助。

var max = await conn.ExecuteScalarAsync<int>("SELECT Max(AccountNumber) FROM [AccountMasterModel] ", null);

最新更新