I’m using sql server and .mdf(db local file) but I have an question, the user that run my application needs too the sql server installed in you computer? or only the .net version compatible with my winForms application is suffcient to run it?
Thanks in advance. 🙂
The .MDF file is always read by a SQL Server instance. Your ‘db local file’ is actually read by a SQL Server Express instance, installed by Visual Studio setup. SQL Server Express ia a fully fledged SQL Server instance with some limitations on usage and licensing, but in all respects is a SQL Server instance. The .MDF files can be copied at will between an Express and a non-Express instance. When you distribute your application, you need to distribute (or require) SQL Server Express as well, see Distributing SQL Server Express. If you architect your application correctly, then the end user can simply replace the connection string to allow the application to connect to a non-Express instance that already exists at the user site.
Also remember to never distribute the MDF file itself. It will be impossible for you to distribute any version of the application after v. 1, because you will have a hard problem to replacing the user’s .MDF w/o loosing his existing data. your development deliverable should be upgrade scripts that you apply to the database to reach the desired schema, then you embed these scripts into the application.