Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a requirement where I need to take the backup of database. Once the user clicks the button I need back up the entire database to the location

 c:/backup

Database: SQL Server 2005.

Thank you

share|improve this question

migrated from stackoverflow.com Oct 26 '09 at 4:53

This question came from our site for professional and enthusiast programmers.

2 Answers 2

You're asking for quite a bit of information in one question, but to start, you can refer to the T-SQL syntax for backing up a database:

BACKUP DATABASE MyDatabase
TO DISK = 'c:\backup.bak'
share|improve this answer

Look this article. You'll need to execute code analogous to this via SqlCommand:

  • Create and open SqlConnection with user/pwd allowing maintenance operations on DB.

  • Create SqlCommand for this connection with proper command text (see linked article).

  • Call SqlCommand.ExecuteNonQuery.

Or else you may use Sql Server object model (SMO) to make a backup. See here (assemblies you need to reference are listed here).

share|improve this answer
    
THIS GIVES ME TAKING BACK UP FROM SQLSERVER . I NEED TO ACHIVE THIS FUNCTIONALITY IN FRONT END USING ASP.NET. –  prince23 Oct 24 '09 at 7:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.