سؤال

I have a database which is sitting on my local PC. I want to create a .mdf file based on this database. I created an empty .mdf file in Visual Studio. How to connect SQL Server Management Studio and run queries against it?

But I want to create .mdf file based on existing database which will save me time on rebuilding whole DB in Visual Studio and also it will have all of the data in tables.

I check this link. it is not helping me solve my question.

Also was trying to copy .mdf file from C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA into my project in App_Data folder but it trowing error cannot complete because file is used by SQL Server
Thank you.

هل كانت مفيدة؟

المحلول

First close all the programs and then stop the SQL SERVER AGENT. You should now be able to copy the .mdf file. After copying the files, don't forget to start the SQL SERVER AGENT.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top