SQL DB install vie C#

  • Thread starter Thread starter Pohihihi
  • Start date Start date
P

Pohihihi

Hello,

I have this development DB (MS SQL 2k) and I want to make a installer which
creates that DB on to customer's given server. Now my problem is 1) how to
do it? 2) what things I have to take care which doing it (e.g. how I will
login into customer's DB and create DB and users and give ownership)

Thanks for the help,

Pohihihi
 
hi
Here are some points for doing that programmaticaly. Alteranatively you may
go for something other like DMO or its like.
Listed out are some major steps..

1. Check existence of SQL Server in clients' machine.

2. Connect with that server. (to master database)

3. Create a new database YourDb

4. Choose a location to save YourDb_Data and YourDb_Log

You may need to do checking of free space, and etc. Alternatively, you
may choose the default location as set by
SQL Server. You require some additional logic to find them out.

4.Copy the YourDbBackup to user's machine. (BackupLocPath )

5. Restore this BackupFile as YourDb

the query will be something like this

sQry = "RESTORE DATABASE YourDb FROM " & _
"disk='" & BackupLocPath & "\ YourDbBackup' With Move " & _
"'YourDB_Data' to '" & LocationPath & "'YourDB_Data.MDF', Move " & _
"'YourDB_Log' to '" & LocationPath & "'YourDB_Log.LDF'"

Ansil
Dimensions
Technopark
Trivandrum
 
Hi Ansil,

Thanks for the email but I know these steps. Only thing I do not know is how
in code.
 
Back
Top