I’m using VS2008 with MS Sql Server 2005 to create an application.
I’ve used linq to query the database, and when I run the application from debug folder on my PC, it runs correctly, but when I copy the debug folder to another PC and try to run it an error message say that can not attach the database or can not find the database.
I have copied the database files into the same folder as the application DLLs, but how can I edit the config file at the debug folder to let the application attach the database from the same folder?
Put your database in a directory called
App_Dataand use the connection string like this :The final folder structure of the app will be like this : bin directory contains the compiled assemblies, and in the same level as bin folder have the App_Data folder and have the database inside this App_Data folder.
Change
SQLExpressto your database, and supply any username password etc if needed also. Look here for examples of good connection strings.