C
christof
Hello,
I'm trying to do a backup by connecting to remote instance, code looks
like that:
using Microsoft.SqlServer.Management.Smo;
using Microsoft.SqlServer.Management.Common;
using System.Data.SqlClient;
string connString = "Server=172.17.0.193\\SQLEXPRESS,15555;
User ID=sa;Password=pass;Net=dbmssocn;
Integrated Security=false;Pooling=false"
SqlConnection sqlConn = new SqlConnection(connString);
ServerConnection srvConn = new ServerConnection(sqlConn);
Server srv = new Server(srvConn);
//it surely works fine, cause for each other operation, like displaying
//tables, databases, views and so on it is ok
Backup dbBackup = new Backup();
dbBackup.Action = BackupActionType.Database;
dbBackup.Database = ddlBackupDatabase.SelectedValue;
BackupDeviceItem dbBackupItem = new BackupDeviceItem();
dbBackupItem.DeviceType = DeviceType.File;
dbBackupItem.Name = Server.MapPath("Backup/filename.bak");
dbBackup.Devices.Add(dbBackupItem);
try
{
dbBackup.SqlBackup(srv);
}
catch (SmoException exc)
{
lblStatus.Text = exc.Message;
}
Unfortunately got an error
"Backup failed for Server '172.17.0.193\\SQLEXPRESS,15555'. "
Microsoft.SqlServer.Management.Common.SqlServerManagementException
{Microsoft.SqlServer.Management.Smo.FailedOperationException}
I'm trying to do a backup by connecting to remote instance, code looks
like that:
using Microsoft.SqlServer.Management.Smo;
using Microsoft.SqlServer.Management.Common;
using System.Data.SqlClient;
string connString = "Server=172.17.0.193\\SQLEXPRESS,15555;
User ID=sa;Password=pass;Net=dbmssocn;
Integrated Security=false;Pooling=false"
SqlConnection sqlConn = new SqlConnection(connString);
ServerConnection srvConn = new ServerConnection(sqlConn);
Server srv = new Server(srvConn);
//it surely works fine, cause for each other operation, like displaying
//tables, databases, views and so on it is ok
Backup dbBackup = new Backup();
dbBackup.Action = BackupActionType.Database;
dbBackup.Database = ddlBackupDatabase.SelectedValue;
BackupDeviceItem dbBackupItem = new BackupDeviceItem();
dbBackupItem.DeviceType = DeviceType.File;
dbBackupItem.Name = Server.MapPath("Backup/filename.bak");
dbBackup.Devices.Add(dbBackupItem);
try
{
dbBackup.SqlBackup(srv);
}
catch (SmoException exc)
{
lblStatus.Text = exc.Message;
}
Unfortunately got an error
"Backup failed for Server '172.17.0.193\\SQLEXPRESS,15555'. "
Microsoft.SqlServer.Management.Common.SqlServerManagementException
{Microsoft.SqlServer.Management.Smo.FailedOperationException}