imran2155
imran2155

Reputation: 111

SQL Server localdb. Confusion about two MDF files

In my WPF/C# app, I recently installed localDB v.11 via nuget. Then I created a .MDF file in the root of my project.

When I run the app, the CRUD operations work fine, but they all are carried out on the database created in the bin\debug folder.

Nothing changes in my root .MDF file. Please guide, why is it happening?

Is there a way to store data in the actual .MDF file? Or am I getting the concept wrong. What happens if I make a release and use it on some other system? My internet search lead me to many links which didn't answer my question.

Please also suggest some tutorial/book for using localdb.

Regards

Upvotes: 1

Views: 495

Answers (1)

marc_s
marc_s

Reputation: 754598

This copying of the .mdf file to bin\debug upon execution of your application is a well-known Visual Studio specific behavior.

This will not happen on your client's PC's.

To be totally safe, use a full path for your .mdf file in your connection string.

Upvotes: 1

Related Questions