Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

Xamarin forms sqlite, getting max id

$
0
0

I am new to Xamarin forms, so I know very little about sqlite in xamarin
I was implementing DatabaseHelper class

    public DatabaseHelper(string dbPath)
    {
        database = new SQLiteAsyncConnection(dbPath);

        database.CreateTableAsync<Product>();   
    }

    public Task<List<Product>> GetProductListAsync()
    {
        return database.Table<Product>().ToListAsync();
    }

    public Task<int> SaveProductListAsync(List<Product> products)
    {
        return database.InsertAllAsync(products);
    }

Product Model class is :

public class Product
{
    public long ProductID { get; set; }

    public String ProductCode { get; set; }

    public String ProductName { get; set; }

    public long BrandID { get; set; }

    public String Brand { get; set; }

    public String Barcode { get; set; }
}

How can i get the maximum ProductID in Product table ?


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>