This time, the project at hand close to the end, the previously less attention to the project packaging problem slowly protruding out, this refers not only to the production of a can install the project installation package, as well as on the lack of running environment when the installation of the database instance and the installation of database data restore. Here is the first about MSDE packaged into the installer's experience to share, then we talk less.
When your project is basically finished testing, ready to release, the production of a user to use the Simple automatic installation package becomes the code after the completion of another problem to be solved, the project development is complete, from the installation, the user should have an initial experience.
Here's a brief description of how to add Microsoft SQL Server Desktop Engine (MSDE) automatic installation merge module MSM in your project:
1. First you need to download the MSDE2000 SP3 installation package. You can download it from the links below, url:http://www.microsoft.com/sql/downloads/2000/sp3.asp
2. Download complete, you can install or zip to the local hard drive, will be able to see: Msi, MSM, setup these 3 directories and setup files, including the MSM folder in the east is this article to introduce the MSDE2000 merge module.
3. Add an installation project to your project (assuming the MySetup1, path is C:\MySetup1), add the project output in the normal steps (project output), select the output file (primary output), and the content file files) two items.
4. Add the merge module (merge Moudle), choose Browse, assign to your MSDE MSM folder, select all the files under MSM and msm\1033 (REPL.MSM, Repl_res. MSM, Dmo_res. MSM and DMO.MSM can not be selected, open.
5. Set the SearchPath in the properties of the installation project, specifying the path of your MSM (two additional: Path\msm and path\msm\1033).
6. Set up additional properties about the installer let us not mention this, it is possible to build your installation works, when the compiler passed, you can see in the C:\MySetup1\Debug\ your packaging project Mysetup.msi.
7. This is the end of the project package, we need to modify the installation package so that it can automatically install an instance of MSDE after the program is installed (assuming the instance name is: MyServer). Now we need to use a MS tool orca, download address: http://support.microsoft.com/default.aspx?scid=kb; en-us;255905 installed Orca, you can use this tool to modify our Mysetup1.msi.
8. Open the installation package file with Orca Mysetup.msi, find the property this Table,add Row in the Propetry fill in Sqlinstancename,value fill in the instance name MyServer. For other parameters, see: http://support.microsoft.com/?id=810826 and http://support.microsoft.com/default.aspx?scid=kb;en-us; 281983
9. All parameters related to the properties of the password, I did not succeed, is SQLSAPWD, this parameter is used with Sqlsecuritymode, but I have not set the success, the password is always empty, somehow!
10. Select InstallExecuteSequence This table, find setpropsqlmsdeinstalled This action, modify 206 to 102; Find Removeexistingproducts, Modify 1525 to 6601. Save, quit!
At this point, run your installation package on a machine that does not have a SQL environment, and after the program is installed, automatically install the MyServer instance of MSDE and automatically start the instance of SQL Server after the machine is restarted.
=======================================================================
The previous article describes how to package with the desktop version of SQL Server to install the simple steps of the installer, and here you also want to: publish the program to a computer that already has a SQL environment, automatically use SQL osql to restore the specified database to your SQL Server date.
First, create a temporary directory in C:\, such as C:\TempBD, copy Osql.exe to the directory, copy your database backup (TRUCKDB) to the directory, and create Restore.bat and Restore.txt files separately under the directory, which reads as follows:
1. restore.bat File content:
OSQL-E-s-i C:\TempDB\Restore.txt