SQLite database in .NET MAUI project

Manie Verster

Member
Joined
Nov 22, 2023
Messages
22
Programming Experience
10+
Good day,

I created a project in MAUI connecting to a SQLite database. Currently, it is stored in the AppDataDirectory but I do not know how to access it.
SQLite database:
        private const string db_name = "VehicleLogBook.db3";
        _connection = new SQLiteAsyncConnection(Path.Combine(FileSystem.AppDataDirectory, db_name));
While I am in the developing stage I need to from time to time access the database. Can anyone tell me how to do this or tell me an alternate way?
 
Perhaps I am missing something. Why not just unpack that code to be 3 lines:
C#:
private const string db_name = "VehicleLogBook.db3";
var databasePath = Path.Combine(FileSystem.AppDataDirectory, db_name);
_connection = new SQLiteAsyncConnection(databasePath);

Then run the debugger and step through the code. Inspect the value of databasePath. Now you know where the database lives. You then use your standard SQLite tools to access that file directly so that you can inspect the database with your other tools.
 
Perhaps I am missing something. Why not just unpack that code to be 3 lines:
C#:
private const string db_name = "VehicleLogBook.db3";
var databasePath = Path.Combine(FileSystem.AppDataDirectory, db_name);
_connection = new SQLiteAsyncConnection(databasePath);

Then run the debugger and step through the code. Inspect the value of databasePath. Now you know where the database lives. You then use your standard SQLite tools to access that file directly so that you can inspect the database with your other tools.

Thanks I will give it a try.
 

Latest posts

Back
Top Bottom