PDA

View Full Version : application deployment problem



Adama
04-18-2008, 06:44 PM
hi all
i am using VS 2005
i want my application when installed to make sure that my database is instaled on sqlserver if not than my application should create the datbase itself
my friend told me to write the code that create the datbase and the tables
( CREATE DATABASE var1 .........) in the class install
but i have more than 8 tables and that will be a long code to affect it to the SqlCommand :(
so is there any other way to make my application create the database when installed

hope someone help or tell me some forums which could help me

regards ,
warid

4play
04-18-2008, 07:17 PM
you can just write the database creation code once in a txt file and run it on install. I would also recommend the 'create if not exist' option so you dont overwrite existing tables.

im more used to mysql so im not sure how to do it in mssql sorry

Adama
04-18-2008, 08:16 PM
thanks it works i added the txt file to my application and execute the code from the txt file
http://msdn2.microsoft.com/en-us/library/49b92ztk(VS.80).aspx

Snee
04-23-2008, 03:46 PM
you can just write the database creation code once in a txt file and run it on install. I would also recommend the 'create if not exist' option so you dont overwrite existing tables.

im more used to mysql so im not sure how to do it in mssql sorry

This is just an aside, at this point, but basic stuff like CREATE should be exactly the same.

It's when you come to stuff like LIMIT/TOP and RAND() and foreign keys things may be a bit different, not to mention stored procedures and all of that jazz.

lightshow
04-28-2008, 07:23 PM
Yeah, but make sure that the user running the application has the right rights to be able to execute sql commands on SQL Server or whichever one you're using.


That's a big problem for my team since they won't give us all the rights we need.


But in your case, at least it is easy to use the "script to" command in the database server and copy the raw sql needed to make a table that already exists, then repeat for all tables.

cheikhanio
05-10-2008, 04:08 PM
wadir botn