Embedding SQL Server in a .NET Application

Hey, I just finished writing a VB.NET application. Now I want to pack the executable and the database into one installer file. I tried using QSetup, InstallShield so that SQL Server is embedded in the installation file, and finally, after several hours of & fail attempts, I have no idea. Is anyone

+4
source share
4 answers

You can right-click on the properties of your Visual Studio installation project, and then there is this Prerequisite button. There you can check the box "SQL Server Express ..." or "SQL Server Compact 3.5"

image image link

It is probably best to install the connection file directly in mdf and attach it when the program starts. This is simpler because a custom installation script is not required to install the database in the database directory itself.

Note: think about using the compact version, itโ€™s less, people donโ€™t like the full engine on their computer :)

+2
source

InstallShield has a concept called "Installation Prerequisites" where you can teach it to install additional packages along with your own. In older versions, this will happen before your MSI is called. In newer versions, you may have a โ€œFeatureโ€ precondition in which prereq can be associated with a function and only set if that function is selected for installation and after it is selected, but before the main action of your MSI occurs during the sequence complete installation.

InstallShield also has a template for executing SQL scripts against your database instance, in order to then load your database into your newly installed instance.

All this is powerful enough, but to study you need to look a little.

+1
source

As far as I know, in fact everything except SQL Server Compact Edition (SQL Server CE) cannot be built into your setup. Microsoft does not want this - you need to install SQL Server Express separately - any other version cannot be sent along with your software (the client must have a license and installation separately).

0
source

You can really distribute the SQL server with your custom application:

http://msdn.microsoft.com/en-us/library/bb264562(SQL.90).aspx

0
source

Source: https://habr.com/ru/post/1310495/


All Articles