0

I'm trying to figure out how to implement relative path instead of the absolute one so I can use the project on other computers. Currently, my connection looks like this

string dataSource = "Data Source=C:\\Users\\John\\source\\repos\\BloodBankNET\\Baza\\PravaBaza.sqlite";

I'll be sending the folder BloodBankNET to the other computer, so ideally it would look something like this

..\\BloodBankNET\\Baza\\PravaBaza.sqlite
Vy Do
  • 46,709
  • 59
  • 215
  • 313
JohnC
  • 171
  • 1
  • 1
  • 10
  • 1
    If you are going to a Network drive you do not want the leading "..\\". It is not relative you want the root of the Network folder. You could map a network drive and use the letter. – jdweng Feb 02 '20 at 08:43

1 Answers1

1

Your question has been answered here: App.config connection string relative path. You can use a dot (.) in your data source. Here is an example: data source=.\data\myDatabase.sqlite

Didier Folly
  • 21
  • 1
  • 3