Restore res = new Restore();
this.Cursor = Cursors.WaitCursor;
this.dataGridView1.DataSource = string.Empty;
try
{
string fileName = this.txtFileName.Text;
string databaseName = this.ddlDatabase.SelectedItem.ToString();
res.Database = databaseName;
res.Action = RestoreActionType.Database;
res.Devices.AddDevice(fileName, DeviceType.File);
this.progressBar1.Value = 0;
this.progressBar1.Maximum = 100;
this.progressBar1.Value = 10;
res.PercentCompleteNotification = 10;
res.ReplaceDatabase = true;
res.PercentComplete += new PercentCompleteEventHandler(ProgressEventHandler);
res.SqlRestore(srv);
MessageBox.Show("Restore of " + databaseName +
" Complete!", "Restore", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
finally
{
this.Cursor = Cursors.Default;
this.progressBar1.Value = 0;
}
}
this is the error!!
tnx for helping im in rush