I don’t know where to place the db so that when i will have my final app .exe, in it’s folder i would have another data folder and in that folder the db.mdf. Here is my connection String :
con.ConnectionString = "Data Source=.\\SQLEXPRESS;AttachDbFilename='C:\\Users\\alex\\Documents\\Visual Studio 2010\\Projects\\Network_Remote_Monitoring\\Network_Remote_Monitoring\\data\\bd.mdf';Integrated Security=True;Connect Timeout=30;User Instance=True";
(i.e. i would like a relative refference to the db, something like AttachDbFilename=”.\data\bd.mdf” )
does the relative path
data\\bd.mdfnot work in connection stings? e.g.,Otherwise you could use the current directory shortcut e.g., something like
Or you could even open a file dialog and ask the user where they want to store the program data, and grab the full path from there.
EDIT: This is how you would achieve what you want, I would however suggest storing the db somewhere else like @TomTom suggested