0

If this question has been asked before please point me in the right direction.

I am working with an MDF file which I attach to localdb in Visual Studio. However, when I run my application it is copied to the Debug folder (I know this is because the "Copy always" option is set)

This works fine because my connection string is:

Data Source=(localdb)\v11.0;AttachDbFilename=|DataDirectory|\Invoicing.mdf;Integrated Security=True

which means my application will look for the database in the Debug folder.

My question is, where should I place the database file because : 1. The file I am attaching to localdb is under the projects folder 2. Meanwhile, my application looks for the database file in the debug folder

I would appreciate any guidelines

Munashe Tsododo
  • 247
  • 1
  • 5
  • 13

1 Answers1

0

I found this article: http://msdn.microsoft.com/en-us/library/ms246989.aspx

I guess I will have to attach the one in the bin folder and choose the option to copy if newer

EDIT: I have done the above and in addition I have created two connections, one for the MDF in the projects folder and the other to view data in the database in the bin folder

Munashe Tsododo
  • 247
  • 1
  • 5
  • 13