I've been trying to publish my application so I can install it on other computers but I always end up with an "SqlException" when trying it on the VS editor and when running it on the other computer
to make things clear I made the database using SqlServer and I attach it to the VS editor until now everything is going well and the application is running on the editor without any exceptions but to make the application working on another computer I needed to copy the (mdf file from the SqlServer directory and paste it in the |datadirectory| of the project ) and of course I changed the connectionString dataSource to point to the mdf file and here where the exceptions begin to rise
The message of the exception says:
An attempt to attach an auto-named database for file C:\Users\xXx\Desktop\Projects\Master Maint\Master Maint\bin\Debug\GMAO.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
when I add the Initial Catalog=test
in the connection string the exception message becomes:
"Cannot attach the file 'C:\Users\xXx\Desktop\Projects\Master Maint\Master Maint\bin\Debug\GMAO.mdf' as database 'test'."
PS 1: It's not a permission issue cause I gave full access to the file from the advanced installer
PS 2: if there is the other way to run the database application on the other computer, I'm listening.
<connectionStrings>
<add name="connString2" connectionString="Data Source=(localdb)\v11.0;AttachDbFilename=|DataDirectory|\GMAO.mdf ;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>