Hello,
Welcome to our Microsoft Q&A platform!
But i want to delete al records in the Table "Person" in ButtonClick.
You could define the DeleteAllItems<T>
method in the 'SQLiteHelper' class to add the function.
public class TodoItemDatabase
{
readonly SQLiteAsyncConnection _database;
public TodoItemDatabase(string dbPath)
{
_database = new SQLiteAsyncConnection(dbPath);
_database.CreateTableAsync<TodoItem>();
}
...
public Task<int> DeleteAllItems<T>()
{
return _database.DeleteAllAsync<TodoItem>();
}
}
Then pass the 'Table' parameter to call the DeleteAllItems method to delete the items of a table.
private async void Button_Clicked(object sender, EventArgs e)
{
await database.DeleteAllItems<TodoItem>();
}
Best Regards,
Jarvan Zhang
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.