Click here to Skip to main content
15,888,177 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello Guys,

I need your advise/suggestion for following situation;
Suppose i have a Windows application (VS 2013) within that I used Local database (.mdf).

Questions :

1. Can we use Service database(MS SQL server) for development and deploy same like local database in side folder?
i.e. Means after installation of windows application. database should work locally (As client machine only have framework in offline mode)

2. Can we restore local database .mdf to MS SQL server studio. Need this while development


Need :

Work on MS SQL server studio while development (b/c its easy) and at the time of deployment deploy inside windows application folder (like Local Database).

Hope you guys understand my concern.

Thanks,
Posted
Comments
BulletVictim 25-Sep-15 5:50am    
Yes it is possible to do so. Firstly the connection strings would obviously need to be changed to look at the different Databases(easier way might be to code bought already but use the if(Debugger.IsAttatched) way to keep working on MS SQL DB while debugging.(using System.Diagnostics). Then Ensure that after publish the Database is also copied to the output path, then using Application.Startuppath to navigate the location of the local DB. Deploying the Local database usually requires you to mark it as a needed file for the application to install. (Scratch around a bit, I cant fully remember as to how to do this exactly. Google could help on that.)
Padam Agrawal 25-Sep-15 7:33am    
Thanks for suggestion. Would be better for me if get some reference.

1 solution

Yes- We can directly attach MDF file with MS SQL server using Attach database option from desire location.

Its working.. :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900