Click here to Skip to main content
15,898,659 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have only one sql database in my Windows Application. Please help me how can i take backup it & restore it.
Thank You.
Posted
Comments
Afzaal Ahmad Zeeshan 25-May-15 16:24pm    
Copy and paste it somewhere else... Then get it back from there if you have still on the same machine (no change in authentication method and credentials).

Read this article -

SQL Server Database Backup and Restore in C#[^]


--
RD Burmon

Hope this helps if yes then accept and vote my answer
 
Share this answer
 
The simplest way is to use the T-SQL commands BACKUP[^] and RESTORE[^] which you would issue through an SqlCommand-object with ExecuteNonQuery() like any other non-query-statement (e.g. INSERT or CREATE TABLE).

For example, the most basic backup-command would look similar to this:
SQL
BACKUP DATABASE myDatabaseName TO DISK = 'C:\somewhere\myDatabaseName.bak';


Additionally to the MSDN-Docs linked above:

Some examples for backup-commands:
http://www.mssqltips.com/sqlservertutorial/20/sql-server-backup-database-command/[^]

How to create a backup- or restore-command via SQL-Server Management Studio (which you could then copy into your application):
http://www.sqlteam.com/article/backup-and-restore-in-sql-server-full-backups[^]
 
Share this answer
 
1.) If you are looking through code in C# then follow the url:
http://manish4dotnet.blogspot.in/2013/03/DatabaseBackupusingCSharp.html[^]

2.) Through interface follow:
http://www.c-sharpcorner.com/Blogs/8679/backup-and-restore-the-database-in-Asp-Net-web-application.aspx[^]

Hope this helps to you!
 
Share this answer
 
 
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