Click here to Skip to main content
15,897,032 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi
i create windows application using c# code , connected to sql server database ,
how can i create setup file included my windows application and database inside it ?
please help me ,,,,,
i need easy way to do my package :)
Posted
Comments
Florian Braun 12-Apr-15 15:34pm    
a good way is using wix. There should be good tutorial on this page here
like http://www.codeproject.com/Articles/331368/WIXDataBase
Style-7 13-Apr-15 2:15am    
Inno Setup

In most Installers like instalshield you can run a batch file after finishing install process. I suggest you to create a Default Database Backup file and restore it by that batch file.

Default Database Backup:
Is a backup file that you make from your Database when your tables are empty or have hard-coded or default data.

Make a Restore Batch-File:
Make a new Text-file and change its extension to `bat` then use `sqlcmd` command to restore your Database like this:
sqlcmd -S %DB_HOST% -Q "<your restore="" query="">"</your>

And a restore query like this:
SQL
RESTORE DATABASE %DB_NAME% FROM DISK = '%BACKUP_FILE%' WITH REPLACE;

Or for a better query follow this question

Add your Backup file and Batch-file to your setup:
When you are making your setup, add the Backup file and Batch-file in it that those will add in the destination path.

Change your setup settings to run Batch-file at the end of setup>
 
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