Click here to Skip to main content
15,888,816 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to Create Setup of the Project in such a way that the Database Script file will be Executed so that I will not create a database later on.
Posted
Updated 11-Apr-10 15:44pm
v2

Just have the application itself be responsible for creating the database. It can check to see if it exists before trying to create it when it starts up.
 
Share this answer
 
You can create an Installer Script.
Just create a class library with the installer script. From that installer script check if the database exists. You can use normal SqlClient classes or you might also include SMO to the installer if you wish.

Now if the database doesnt exists, run the database creation logic, and place the connectionstring somewhere secure.

From your application use this connectionstring always.

I have already built one installer using this, where I have used SMO to create database. It is working great.

:)
 
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