You can specify a relative path as described in Lefty's answer.
However this will be relative to the current working directory, which will not necessarily be the directory containing your executable.
One way round this is to modify the connection string before using it, e.g.
In app.config:
connectionString="data source={AppDir}dataEmailDatabase.sqlite
In your code:
ConnectionStringSettings c = ConfigurationManager.ConnectionStrings[name];
if (c == null)
{
... handle missing connection string ...
}
string fixedConnectionString = c.ConnectionString.Replace("{AppDir}", AppDomain.CurrentDomain.BaseDirectory);
... use fixedConnectionString
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…