0
votes

I am using latest version of Sqlite-net-pcl Nuget by Frank A. Krueger .

I need to get the maximum value of the column AccountNumber from the table AccountMasterModel.

I tried this

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

I call this kmethod as follows

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

The code executes successfully for me. Even I have the values 23 and 54 in the AccountNumber Column I always get the value 0 in max. Actually I need to 54 in max but I get only 0. Need a help here.

1

1 Answers

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