ARTICLE

Backup utility in .Net

Posted by Nikhil Kumar Articles | ADO.NET in C# April 03, 2009
This is a article named backup is used to create a backup of your data and can restore your deleted data also.
Reader Level:
Download Files:
 


BackUp Software
Namespaces... which u will indclude......
 
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.SqlServer.Management.Smo;
using Microsoft.SqlServer.Management.Common;

Coding which u will on the click event of connect button...
 private void btnConnect_Click(object sender, EventArgs e)
        {
            try
            {
                if (cmbsrv_name.SelectedItem != null && cmbsrv_name.SelectedItem.ToString() != "")
                {
                    ServerConnection srvcon = new ServerConnection(cmbsrv_name.SelectedItem.ToString());
                    srvcon.LoginSecure = false;
                    srvcon.Login = txtuserid.Text;
                    srvcon.Password = txtPassword.Text;
                    srv = new Server(srvcon);
                    foreach (Database db in srv.Databases)
                    {
                        cmbDatabase.Items.Add(db.Name);
                    }
                }
                else
                {
                    MessageBox.Show("Please select a server first", "Server Not Selected", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
If u are running sql by windows auth....
then remove login and password and type Integrated security = true;
 type this code on the click event of backup button after conneted to the sql...
and for full suppot please download this file...

Login to add your contents and source code to this article
post comment
     

Good Evening, Sir

Thank you so much for your suggesstion sir, i will follow it ...

Nikhil

Posted by Nikhil Kumar Apr 14, 2009

Nikhil, Post all your small articles and tips as a blog in the blogs section. Click on the Blogs link on the header. Thanks, Mahesh

Posted by Mahesh Chand Apr 14, 2009
COMMENT USING
PREMIUM SPONSORS
DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and add new content to existing PDF documents from within your applications.
SPONSORED BY
  • PDF reports have never been easier to create. With our included WYSIWYG Designer, you can layout your reports, set up your data source and let DynamicPDF ReportWriter do the rest.
Join a Chapter