I have a data.db file and I want to delete some data so use this code :
using (var db = new LiteDatabase("Filename=data.db;upgrade=true"))
{
var collection = db.GetCollection<Capture>("capture");
//show db count before delete
MessageBox.Show("COUNT : " + collection.Count().ToString());
var col = db.GetCollection<Capture>("capture");
var data_list = col.Find(Query.All(), 0, 3);
foreach (var row in data_list)
{
//show row id before delete
MessageBox.Show(row.Id.ToString());
col.Delete(row.Id);
}
//show db count after delete
MessageBox.Show("COUNT : " + collection.Count().ToString());
this.Close();
and this code work fine but before run code I can open the data base with LiteDB Viewer without any error but after when I want to verifie if the data was deleted LiteDB Viewer gives me that error : Selected file is invalid or not supported
anynon can help me please. and thanks in advance.
It's about the version of LiteDB in NuGet Package Manager, make sure that are the same (.db file and in the project)