I'm trying to use a local db for my application, and want it to reside in a folder inside my application. Unlees I'm missing something, this shouldn't be a problem with user rights, since it is in the application folder.
The connection string is this:
<connectionStrings>
<add name="Calendario2DB"
connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=\AppData\Database1.mdf;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
I'm Using a code first aproach, so the database should be generated (filled) at run time, but I have a problem with
AttachDbFilename=\AppData\Database1.mdf
This should be pointing to a folder in my app (called appdata) but is not working with an error:
A file activation error occurred. The physical file name '\AppData\Database1.mdf' may be incorrect. Diagnose and correct additional errors, and retry the operation. CREATE DATABASE failed. Some file names listed could not be created. Check related errors.
So how do I have to write the path name to the phisical file?