I am currently mapping a network drive and connecting to the file (Z:\Data\Database.db) that way. I would like to be able to just use a relative path (\server\Data\Database.db) in the connection string but it is giving me a SQLite error "unable to open database file". A Directory.Exists(\\server\Data\Database.db); check is returning true.
Here is the attempt to open the connection using the path "\\server" as the argument:
public static OpenDB(string dbPath)
{
using (SQLiteConnection conn = new SQLiteConnection($"Data Source={Path.Combine(dbPath, "Data\\Database.db")}"))
{
if (dbPath != null && dbPath != "")
{
try
{
conn.Open();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Unable to Open Database", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}