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...