所以场景是它在创建它时似乎附加到bak文件,是否可以阻止它执行此操作并仅备份当前版本?
这是我的代码
Server backFromServer = new Server(@"server ip add");
backFromServer.ConnectionContext.LoginSecure = false;
backFromServer.ConnectionContext.Login = "uname";
backFromServer.ConnectionContext.Password = "psd";
Database backFromDb = new Database();
backFromDb = backFromServer.Databases["dbname"];
Backup bkpDatabase = new Backup();
bkpDatabase.Action = BackupActionType.Database;
bkpDatabase.Database = backFromDb.Name;
bkpDatabase.Incremental = false;
bkpDatabase.LogTruncation = BackupTruncateLogType.Truncate;
BackupDeviceItem bkpDevice = new BackupDeviceItem(@"D:\backupfolder\backup.bak",
DeviceType.File);
bkpDatabase.Devices.Add(bkpDevice);
bkpDatabase.SqlBackup(backFromServer);