Forum Xamarin.Forms

how to drop sqlite table on program start

JamesThompson.9722JamesThompson.9722 GBMember, University

Im creating a shopping application which stores the users selected cart items in an sqlite table, Im wanting to delete that table everytime the application is openned, not restored.

Ive looked at the drop table, but everything I try in their kicks out with an error telling me the table does not exist.

I have this for creating the table

    public CartRepo (string dbPath)
        conn = new SQLiteAsyncConnection (dbPath);
        conn.CreateTableAsync<Product> ().Wait ();

and have tried to do this for deleting the table

    public void DeleteCart ()
        conn.DeleteAsync (conn.Table<Product> ());

but cant seem to get this to work.

Any ideas on how this can be achived ?


Sign In or Register to comment.