fix issue

This commit is contained in:
2022-03-15 20:12:40 +08:00
parent 5b209cc19c
commit 8ba6f4bf85
8 changed files with 70 additions and 13 deletions

View File

@@ -17,7 +17,7 @@ namespace Billing.Store
public static string DatabasePath => Path.Combine(PersonalFolder, dbfile);
#region Sqlite3
private const string dbfile = "data.db3";
private const string dbfile = ".master.db3";
private static SQLiteAsyncConnection database;
#endregion
@@ -42,6 +42,7 @@ namespace Billing.Store
try
{
File.Copy(file, path, true);
File.Delete(file);
}
catch (Exception ex)
{
@@ -167,7 +168,15 @@ namespace Billing.Store
public static async Task<int> GetLogsCount()
{
await Instance;
return await database.ExecuteScalarAsync<int>("SELECT COUNT(Id) FROM [Logs]");
try
{
return await database.ExecuteScalarAsync<int>("SELECT COUNT(Id) FROM [Logs]");
}
catch (SQLiteException)
{
await database.CreateTableAsync<Logs>();
return 0;
}
}
public static async Task<int> SaveLogItemAsync(Logs log)
{