How to make an installer for a project with a Sql server database, which can be used in any PC


please take out a problemon, what happens is that I made a Visual project in c # in visual studio 2017, with a database for a Login, where everything was fine, until I made the installer, and I realized that the database was not included. How can I do so that the base goes inside the installation package and that it works without time delays in any PC? One more thing, I do not have Sql server installed as such, the base creates it inside visual studio (I leave the capture below) I'm a beginner, it's the first time I've done something like that, and this is for tomorrow, help please!

asked by Axwell Duarte 02.01.2019 в 05:10

1 answer


If it is urgent I would recommend you to do the same bd that you have in SQL Server but in Access, you should not change the program queries if you create the same tables and relationships in access, if you are going to generate an installer and the .exe will be next to the bd in access .accdb in the connection you would put in the string:

    Data Source=|DataDirectory|\BaseDeDatos.accdb;

Also, your file is .mdf, if it was .sdf you could manage a portable version with SQL Server Compact, because if you are using SQL Express Local DB you would have to install and restore the bd in the client and it is not convenient, you can check if you use Local DB by going to the start menu and looking for Visual Studio Installer in Workloads on the right in Installation Details you extend the arrow that says .NET Desktop Development at the end of Optional says SQL Server Express 2016 LocalDB, that's a version lighter than sql server that is not portable like the Compact version. I recommend that you start doing the same bd in access and changing the connection string as mentioned or look for another form, so you always ensure that the access file will go into the installation. Greetings

answered by 02.01.2019 в 07:02