我尝试将 .mdf 文件转换为 .bak 文件,我一直在阅读本指南:http ://forums.asp.net/p/1448416/3870094.aspx
BACKUP DATABASE [NameOfDatabase] TO DISK = N'D:\path\filename.bak' WITH NOFORMAT, NOINIT, NAME = N'NameOfDatabase-Full Database Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10
将 NameOfDatabase 替换为 .... 数据库的名称。
将 D:\path\filename.bak 替换为您要备份的位置
出于美观的索引原因,替换名称 = N 数据库名称...
但是当我运行它时会收到一条错误消息。
在服务器资源管理器的 Visual Studio 2010 中,我选择 Data Connection/myDatabase.mdf 并右键单击存储过程并选择“添加新存储过程”。我在那里写:
BACKUP DATABASE [myDatabase] TO DISK = N'C:\db\dbCopy.bak' WITH NOFORMAT, NOINIT, NAME = N'dbCopy-Full Database Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10
当我选择文本并运行选择时,我收到以下错误消息:
从 mssql 执行选定的脚本:://Home\e1d5110c-dd6f-4d/C:\USERS\myHome\DESKTOP\myPage\APP_DATA\MYDATABASE.MDF/dbo/Stored Procedure/dbo/StoredProcedure1
Database 'myDatabase' does not exist. Make sure that the name is entered correctly.
BACKUP DATABASE is terminating abnormally.
No rows affected.
(0 row(s) returned)
我究竟做错了什么?如果我将 'myDatabase' 更改为 'C:\USERS\myHome\DESKTOP\myPage\APP_DATA\MYDATABASE.MDF' 我会收到以下消息:
Database 'C:\USERS\myHome\DESKTOP\myPage\APP_DATA\MYDATABASE.MDF' does not exist. Make sure that the name is entered correctly.
BACKUP DATABASE is terminating abnormally.
No rows affected.
(0 row(s) returned)