I do a very similar thing in an app I have written. I just have my code execute batch files. Here's a sample:
@echo off
C:
cd database
osql -S %1 -d master -U %2 -P %3 -I < script1.sql > script1.log
osql -S %1 -d master -U %2 -P %3 -I < script2.sql > script2.log
osql -S %1 -d master -U %2 -P %3 -I < script3.sql > script3.log
osql -S %1 -d master -U %2 -P %3 -I < script4.sql > script4.log
@cls
The .sql files are just the SQL commands to create the tables and set up the relationships. This way is good, because it is pretty much version/platform independent, ie you can use the .sql files for SQL Server or Oracle or MySQL etc. Another alternative (again using batch files) is to restore a backup of the database in raw form. This is much faster, but doesn't survive upgrades etc. as well.
As far as installing the MSDE, there are .MSM's (merge modules) that you can just incorporate into your installer, and it will install everything in one shot, with your one big .MSI file. The only problem with this is that the MSDE and your app are now tied together. There may be instances where it is nicer to just install the MSDE separately.
Mike
|