Relative Path + SQLite on ASP.Net = Problem
SQLite is a very nice light-weight embedded database. It's great for testing and it even provides an in-memory database (more on that in another post).
I am using it in a new project of mine. I wanted to have the database file under the web site structure. So all I needed to do was set the connection string to:
Data Source=myDb.db;New=True;UTF8Encoding=True;Version=3;
Right? Wrong!
This path looks for the current directory, which in my case is the solution folder (don't ask!). So I thought: "Well, I'll just use a relative path instead."
Now I got it, right? Wrong!
After a little digging, I found out that this is the path you should use:
Data Source=|DataDirectory|fjords.db;New=True;UTF8Encoding=True;Version=3;
The |DataDirectory| token maps to the App_Data folder in your web application. Finally it works.
Hope this saves some headaches!
#140