Backup database

  • Thread starter Thread starter Mohammed Abdel-Razzak
  • Start date Start date
M

Mohammed Abdel-Razzak

Dear sirs
I`m using MS-SQL server to make my database\and connect to
it using C#
is there any way that I can make a backup to my database
using C#

thanks
Mohammed
 
Hi,

To do backup in MS-SQL Server through code you have to use SQL-DMO. SQL-DMO is bascially set of COM components. So to do things using SQL-DMO in C# requires you to use Interop services.

Check out the following code to do backup. This code uses C# and SQL-DMO.

<http://www.sqldev.net/sqldmo/SQL-DMO.NETEventsCS.htm>

Hope this helps...

Regards,
Madhu

Microsoft C# MVP | MCSD.NET
 
Mohammed Abdel-Razzak said:
Dear sirs
I`m using MS-SQL server to make my database\and connect to
it using C#
is there any way that I can make a backup to my database
using C#

thanks
Mohammed

You can use the Transact SQL Backup command with the
SqlCommand.ExecuteNonQuery method.

See the SQL BOL for examples of the Backup command.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

restoring database using SQLDMO 1
Backup database 1
Discussion group 1
SqlCommand 3
SQL SERVER 2005 - Backup/Restore database . 2
modem 1
Pie chart 2
MAster Detail 2

Back
Top