Backup Utility In .Net

BackUp Software
 
Namespaces... which u will indclude......
  1. using System;  
  2. using System.Collections.Generic;  
  3. using System.ComponentModel;  
  4. using System.Data;  
  5. using System.Drawing;  
  6. using System.Text;  
  7. using System.Windows.Forms;  
  8. using Microsoft.SqlServer.Management.Smo;  
  9. using Microsoft.SqlServer.Management.Common;  
Coding which u will on the click event of connect button...
  1. private void btnConnect_Click(object sender, EventArgs e)  
  2.        {  
  3.            try  
  4.            {  
  5.                if (cmbsrv_name.SelectedItem != null && cmbsrv_name.SelectedItem.ToString() != "")  
  6.                {  
  7.                    ServerConnection srvcon = new ServerConnection(cmbsrv_name.SelectedItem.ToString());  
  8.                    srvcon.LoginSecure = false;  
  9.                    srvcon.Login = txtuserid.Text;  
  10.                    srvcon.Password = txtPassword.Text;  
  11.                    srv = new Server(srvcon);  
  12.                    foreach (Database db in srv.Databases)  
  13.                    {  
  14.                        cmbDatabase.Items.Add(db.Name);  
  15.                    }  
  16.                }  
  17.                else  
  18.                {  
  19.                    MessageBox.Show("Please select a server first""Server Not Selected", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);  
  20.                }  
  21.            }  
  22.            catch (Exception ex)  
  23.            {  
  24.                MessageBox.Show(ex.Message);  
  25.            }  
  26.        }   
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...


Similar Articles