views:

96

answers:

4

I have a VB project that runs on SQL SERVER 2005, while making the setup file for it, how do I include the DB?

+1  A: 

You don't

Typically you have a DB generation script that is run either as part of setup or as part of first run of application

You also need to consider migrations (changes to DB when new releases of your application are published)

Consider using MigratorDotNet or RikMigrations to solve these problems in a seperate installer/upgrade program if you are still using VB6

TFD
A: 

I disagree, you could include the database. Simply distribute the .MDF file with your application.

Of course, the setup application would have know how to attach the database to an existing SQL Server RDBMS.

AngryHacker
Yes you could do that, but it cause many issues. How do you upgrade it without loosing data?
TFD
A: 

Both methods given in the above answers will work. I have tried them both. However using a db generation script reduces the size of the final deployment files considerably. I would launch the script on the first run of the application and not in the setup itself.

Jack Njiri
A: 

I will second jack on this one.

From my experience of using installs that require an actual database file tend to have more issues then when updating or on first install when running scripts. As jack mentioned another bonus is reduced file size.

You can create who database scripts by right clicking on the required database, and selecting the script database option. Note however this will only create the tables and fields and not replicate any data.

Audioillity