0

我正在尝试备份 sql server compact 数据库,我使用了此代码,但它不起作用。

        var srv = new Server(@".\SQLEXPRESS");
        SaveFileDialog SD = new SaveFileDialog();
        SD.ShowDialog();
       Backup BkpDBase = new Backup();
        this.Cursor = this.Cursor = Cursors.WaitCursor;
        //this.dataGridView1.DataSource = string.Empty;
        try
        {
            string fileName = SD.FileName;
            BkpDBase.Action = BackupActionType.Database;
            BkpDBase.Database = "TapeDatabase.sdf";
            BackupDeviceItem bkpDevice = new BackupDeviceItem(fileName, DeviceType.File);
            BkpDBase.Devices.Add(bkpDevice);
            BkpDBase.SqlBackup(srv);

        }

        catch (Exception ex)
        {
            MessageBox.Show(ex.ToString());
        }
4

1 回答 1

2

使用 SQL server compact,只需使用 File.Copy

于 2013-07-23T07:10:50.283 回答