|
-
November 9th, 2008, 10:07 PM
#1
SQL DB Deployment
Hi all,
I've developed an application that's using SQL Server for DB, now I want to create a setup and give it to users.
For the DB part, I have a simple '.mdf' file that is created with SQL Server and connecting to it like this:
sql_conn = new SqlConnection(@"AttachDBFilename=c:\test.mdf;Integrated Security=true");
then it's a simple connection; but I don't know how to use my DB in the user's computer, I should only copy the .mdf file in the user's computer? what's the exact steps to deploy a SQL DB related application?
I've searched the Internet and some eBooks + MSDN but didn't find anything about that.
I'm working with C# 2.0 WinApp in VS2005 and it's for XP or Vista.
Please answer soon, since I want that in a week.
Thanks in advance.
-
November 9th, 2008, 10:14 PM
#2
Re: SQL DB Deployment
Assuming there was no associated log file (.ldf), then copying the .mdf to the target and "attaching" to it is usually sufficient.
The alternative is to make a backup of the mdf file,and then "restore" it into the new server.
Some minor tradeoffs between the approaches, but both are common....
TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
2008, 2009,2010
In theory, there is no difference between theory and practice; in practice there is.
* Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions 
* How NOT to post a question here
* Of course you read this carefully before you posted
* Need homework help? Read this first
-
November 10th, 2008, 03:11 AM
#3
Re: SQL DB Deployment
 Originally Posted by Promotional Engine
... I should only copy the .mdf file in the user's computer? ...
Aside from TheCPUWizard's suggestion, of course you need to install Sql Server in the target machine also assuming it is not yet installed...
-
November 10th, 2008, 02:51 PM
#4
Re: SQL DB Deployment
Thanks guys,
TheCPUWizard, can you explain the steps and statements in C# 2.0 to attach or back&restore a DB?
dee-u, the user should have SQL Server installed?! It's practical? I don't think it's the way that current apps are going! Please tell me what should be installed on the target machine and how to install that with an installer like .NET Setup. 
Thanks.
-
November 10th, 2008, 03:05 PM
#5
Re: SQL DB Deployment
1) The steps are NOT (typically) done fromwithin the application.
2) YES SQLServer needs to be installed on the machine. The MSI should be launched from within your own installer.
TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
2008, 2009,2010
In theory, there is no difference between theory and practice; in practice there is.
* Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions 
* How NOT to post a question here
* Of course you read this carefully before you posted
* Need homework help? Read this first
-
November 11th, 2008, 12:52 AM
#6
Re: SQL DB Deployment
 Originally Posted by Promotional Engine
...It's practical?...
It is a requirement...
-
November 11th, 2008, 12:58 AM
#7
Re: SQL DB Deployment
May I add that if it is going to be in a multi-user environment then you should just install in one machine and access the database from there...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|