Click here to Skip to main content
15,891,607 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a WPF app using SQL server 2014 database. I would want to create a setup using InstallShield that would let users install in their PCs without doing much(just some clicks and they should be able to run the app). It's my first time using InstallShield. I have been searching for tutorials online but most of them dont involve database. Here are my requirements:
1. Include a database (.mdf) or its script to my setup
2. During installation, create a server if it doesnt exist and attach the database created / .mdf to the server and update the connection strings.

I already know how to setup prerequisites.

Thank you for your help.

What I have tried:

I have tried to include scripts for database creation and adding prerequisites to SQL server Express. Every time I try to install the app I end up on a screen asking me to select the server and enter the username and password. I enter sa and nothing as password (as setup in installshield) but it wont accept.
And I completely have no idea on how it is gonna attach the database to the server and whether the script for database creation is already run or not.
Posted
Updated 12-Mar-16 7:28am
v2

1 solution

A similar question was asked before, it might be useful to look at the answers: How do I setup make for Sqlserver 2014 with install shield?[^]

As I don't use Installshield but the free Inno Setup installer, I can't help you with Installshield, but can tell that installing SQL Server is a complex matter with lots of pitfalls:

Usually I check first if SQL Server is already installed.
If not, check if a 32 or 64 bits version must be installed.
Run the SQL Server (Express) installer from a temp directory with the correct parameters.
If you want to keep things simple, you can use Windows Authentication (no username and password asked).
Install your application and let it run an SQL script to create the database.
Working with .mdf files directly is asking for trouble.

Here is a simple Inno Setup script:
Inno Setup Script to Install SQL Server 2008 R2 with Tools[^]

The best advice I can offer however is: do not use SQL Server !
I got so fed up with the complications and bloated size of SQL Server that I decided to use PostgreSQL (with Npgsql in C#) instead.

Here is a conversion program to convert SQL Server databases to PostgreSQL:
Convert SQL Server Database to PostgreSQL[^]
 
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