2
Answers

How to create dynamic connection string for SQLite database in C#

Yuvraj Jambhle

Yuvraj Jambhle

3y
1.7k
1

Hello,

I have a static connection string for SQLlite DB connectivity. 

 string hmiDbCon = @"Data Source= C:\Users\user\Desktop\ReportTmplate\Database.db; version=3"; 

But I want to read SQLite DB file from any location. I got file location and file name using this below code.

string dbPath = Path.GetFullPath(dbSelect.FileName);

Now question is how can I create dynamic connection string.

Please suggest me how can I use that string dbPath in above mentioned string.

Answers (2)