|
Forums » .NET » ASP.NET »
|
Database Backup usingc#.net |
Posted Date: 05 Aug 2010 Posted By:: saravanan Member Level: Silver Member Rank: 1751 Points: 1
Responses:
3
|
Hi dear friends,
I m developing an application using C#.Net 2005 and MySql 5.0
How to take backup of specific database in MySql 5.0 and Restore the backup database through C#.net 2.0???Can u give me the entire code for this one...i need the aspx.cs ,aspx and where i have to write the codes.....plz dears...its very urgent.............
|
Responses
|
#535132 Author: Christopher F Member Level: Gold Member Rank: 172 Date: 05/Aug/2010 Rating:  Points: 2 | Please refer this link
http://www.codeproject.com/KB/database/SQL_Server_2005_Database.aspx
http://www.codersource.net/asp-net/ado-net/sql-dmo-for-automated-database-backup-and-restore.aspx
| #535149 Author: VASANTH R Member Level: Gold Member Rank: 311 Date: 05/Aug/2010 Rating:  Points: 2 | String ServerName="WEBMS"; String DBName"E123"; String UserName="sa"; BackupDeviceItem bdi = new BackupDeviceItem(BackupPath, DeviceType.File); Microsoft.SqlServer.Management.Smo.Backup bu = new Microsoft.SqlServer.Management.Smo.Backup(); bu.Database = DBName; bu.PercentComplete +=new PercentCompleteEventHandler(bu_PercentComplete); bu.Devices.Add(bdi); bu.Initialize = true; Server server = new Server(ServerName); bu.SqlBackup(server);
Regards, R.Vasanth
| #535168 Author: vasanth Member Level: Silver Member Rank: 889 Date: 05/Aug/2010 Rating:  Points: 2 | public void BackupDatabase(String databaseName, String userName, String password, String serverName, String destinationPath) { Backup sqlBackup = new Backup(); sqlBackup.Action = BackupActionType.Database; sqlBackup.BackupSetDescription = "ArchiveDataBase:" + DateTime.Now.ToShortDateString(); sqlBackup.BackupSetName = "Archive";
sqlBackup.Database = databaseName;
BackupDeviceItem deviceItem = new BackupDeviceItem(destinationPath, DeviceType.File); ServerConnection connection = new ServerConnection(serverName, userName, password); Server sqlServer = new Server(connection); Database db = sqlServer.Databases[databaseName]; sqlBackup.Initialize = true; sqlBackup.Checksum = true; sqlBackup.ContinueAfterError = true; sqlBackup.Devices.Add(deviceItem); sqlBackup.Incremental = false;
sqlBackup.ExpirationDate = DateTime.Now.AddDays(3); sqlBackup.LogTruncation = BackupTruncateLogType.Truncate;
sqlBackup.FormatMedia = false;
sqlBackup.SqlBackup(sqlServer); }
|
|
| Post Reply |
|
|
|
 | | This thread is locked for new responses. Please post your comments and questions as a separate thread. If required, refer to the URL of this page in your new post. |
|
|
|
|
 Follow us on Twitter: https://twitter.com/dotnetspider
|
|