Question

I have an application which uses Sql Server Express Edition to store data. I have a database with 8-10 tables in it. I have mdf and ldf file with me. Now i want to install my application in some other computer, then how to deploy my database with my installation files (assuming the other computer already have Sql Server with them). Can i use my mdf and ldf files, or i need to create my database and tables again programatically during installation of my Application.

I am a newbie, please guide me. I am using .Net framework 4.0 and Visual Studio Professional Edition.

Was it helpful?

Solution

SQL Server Express runs out-of-process, so your application does not control the data files. You have to submit your application data to SQL Server via data statements, replication, or whatever, and SQL Server gets to decide what to do with them.

You may be able to submit an .mdf directly to SQLS Express via an AttachDBFilename connection string, I have not tried this.

If you used an embedded database like SQL Server Compact you would be able to include the data along with your application. Whether this is a better solution depends on what else you are doing with your database.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top