Problem in BackUp
-
Hi to all, I write below code to create backup but it doesn't work
ServerConnection connection = new ServerConnection(".");
Server srv = new Server(connection);
SaveFileDialog sfd = new SaveFileDialog();
if (sfd.ShowDialog() == DialogResult.OK)
{
Backup bkpDatabase = new Backup();
bkpDatabase.Action = BackupActionType.Database;
bkpDatabase.Database = txtDBName.Text;//txtDBName contain Name of database
BackupDeviceItem bkpDevice = new BackupDeviceItem(sfd.FileName, DeviceType.File);
bkpDatabase.Devices.Add(bkpDevice);
bkpDatabase.SqlBackup(srv);
}//if -
Hi to all, I write below code to create backup but it doesn't work
ServerConnection connection = new ServerConnection(".");
Server srv = new Server(connection);
SaveFileDialog sfd = new SaveFileDialog();
if (sfd.ShowDialog() == DialogResult.OK)
{
Backup bkpDatabase = new Backup();
bkpDatabase.Action = BackupActionType.Database;
bkpDatabase.Database = txtDBName.Text;//txtDBName contain Name of database
BackupDeviceItem bkpDevice = new BackupDeviceItem(sfd.FileName, DeviceType.File);
bkpDatabase.Devices.Add(bkpDevice);
bkpDatabase.SqlBackup(srv);
}//ifI think you need to clarify with some more detail... your given code snippets is not enough to figure out what is wrong.
Thanks Md. Marufuzzaman
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
-
I think you need to clarify with some more detail... your given code snippets is not enough to figure out what is wrong.
Thanks Md. Marufuzzaman
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
[^]
-
Hi to all, I write below code to create backup but it doesn't work
ServerConnection connection = new ServerConnection(".");
Server srv = new Server(connection);
SaveFileDialog sfd = new SaveFileDialog();
if (sfd.ShowDialog() == DialogResult.OK)
{
Backup bkpDatabase = new Backup();
bkpDatabase.Action = BackupActionType.Database;
bkpDatabase.Database = txtDBName.Text;//txtDBName contain Name of database
BackupDeviceItem bkpDevice = new BackupDeviceItem(sfd.FileName, DeviceType.File);
bkpDatabase.Devices.Add(bkpDevice);
bkpDatabase.SqlBackup(srv);
}//ifBetter, but still needs some more. What is the error message and which line of code generates it. If you have no errors then you need to look into the event logs on the server to see if there are any messages from SQL Server.
Never underestimate the power of human stupidity RAH