Shamil Salakhetdinov
shamil at smsconsulting.spb.ru
Fri Jan 14 10:51:49 CST 2011
Hi All --
That should be simple(?) but google somehow doesn't give any useful feedback
(or I'm missing it).
I wanted to have the following connection string from app.config to use
relative path to MS Access db - relative to the folder where app.config (its
assembly) will be installed on target system:
<connectionStrings>
<add
name="ProductPicturesLocator.Properties.Settings.TestDataConnectionString"
connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=.\Database\TestData.mdb"
providerName="System.Data.OleDb" /> </connectionStrings>
If I write:
Data Source=.\Database\TestData.mdb
it works on start-up and when I work with main form, but as soon as I use,
e.g., OpenFile fialog, which changes default folder main form's update which
is bound do a dataset which uses the above connection string fails to update
db as it gets now improper fullpath for db...
Isn't there something like
Data Source=~\Database\TestData.mdb
or
Data Source={Application}\Database\TestData.mdb
or
...
way to specify "stable" relative path to the MS Access db - relative to the
app.config's assembly location?
I do not want to use DSN...
Thank you.
--
Shamil