Abhilash JA Abhilash JA - 4 months ago 33
C# Question

C# - Access SQLite dabase for WPF application

I have create Set up file for WPF application and the database is SQLite DB. After the installation the SQLite DB is located this path in C folder,

C:\Program Files (x86)\myCompany\myScanApp.

enter image description here

Then I have written connection string like this way for establishing a connection to SQLite DB,

static SQLiteConnection dbConnection = new SQLiteConnection(@"Data Source=C:\Program Files (x86)\myCompany\myScanApp\test.s3db;");

Then I have created a Setup file again and then run this application on another PC. But, it is failing to run in the PC. How can I access DB in application?

using(SQLiteConnection conn= new SQLiteConnection(@"Data Source=C:\Program Files (x86)\myCompany\myScanApp\test.s3db;"))

    SQLiteCommand command = new SQLiteCommand("Select * from yourTable", conn);
    SQLiteDataReader reader = command.ExecuteReader();

    while (reader.Read())


Something like this should work. Here whole article Getting started with SQLite in C#