1. open Inno Setup, select "Create a new script file using the script wizard", and click "OK"
2. click "Next"
3. enter the Program information of the application, and click "Next"
4. set the application directory and click "Next"
5. select your executable file and add the following file to other Application Files:
(1) cms07 Description: database backup file
(2)osql.exe description: this file is available in the SQL bin directory
(3366restore.txt file, which contains the following content:
use master
If exists (select * From sysdevices where name = 'cms07 ')
exec sp_dropdevice 'cms07'
else
exec sp_addumpdevice 'disk', 'cms07', 'c: /program files/Microsoft SQL Server/MSSQL/data/cms07.mdf '
Restore database cms07
from disk = 'C: /program files/MyApp/cms07 '
with replace
Note: you must write your own database name
(4) Restore. BAT file, which contains:
osql-e-s-I restore.txt
6. Always click "Next" (some modifications can be made in the middle as needed), and finally click "finish". A dialog box is displayed, prompting "Do You Want To compile the new script now? ", Select" no "and add it to the first line of [run]Code:
Filename: "{app}/restore. Bat" // release the database during installation
7. Compile and run the program to package it into an installer.