I'm working on deploying my software using Advanced Installer and I want to attach the .mdf file located in the [APPDIR] (client pc's destination folder). I came across this connection string:
This will attach with no problem when my app runs but, after its done, it will pop up an error "database mydbfile already exists, choose a diferent name" every other time the app is opened. In the description it says: "If the named database have already been attached, SQL Server does not reattach it. It uses the attached database as the default for the connection." But its not happening as its trying to attach it every single time.
What I have tried:
It only works the first time, after that it will try to attach it again (it will not detect that its already there) and fail, giving me the error and the connection will not work.