SQL Server无法打开Visual Studio创建的数据库 [英] SQL server won't open DB created by Visual Studio

查看:126
本文介绍了SQL Server无法打开Visual Studio创建的数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在Visual Studio中构建了一个ASP.Net网站,并在其中创建了数据库(.mdf文件位于APP_data文件夹中).

I've built an ASP.Net site in Visual Studio, and created the DB inside it (the .mdf file is in the APP_data folder).

现在,当我想在客户站点中进行部署时,我会考虑在不打开Visual Studio的情况下使用SQL Server Express工具(备份等)来维护数据库.

Now, when I want to deploy in the customer site, I think about maintaining the DB without open Visual Studio, and by using the SQL Server Express tools (back up etc.).

我已经搜索了如何执行此操作,并得知我应该将.mdf文件附加到sql server.

I've searched how to do this, and learned that I should attach the .mdf file to sql server.

我尝试执行此操作,但失败了!

I've tried to do this and failed!

错误是:无法打开物理文件< .mdf>".操作系统错误5:"5(由于该错误而无法检索文本.原因:15105)".(Microsoft SQL Server,错误:5120)

Google并没有帮助我解决问题.

Google didn't helped me to solve the problem.

现在我有2个选择:1.在当前数据库为.mdf文件且ASP.Net可以通过SQL Server Express Compact连接到该站点的情况下,放弃并部署该站点.

Now I have 2 options: 1. To give up and deploy the site in the current situation where the DB is an .mdf file and ASP.Net can connect to it by the SQL server express compact (in the proccess).

  1. 这次要在SQL Server数据库中提取所有数据(我需要考虑如何...)并将其导入到新的数据库中.

您会建议做什么?

先谢谢您.

推荐答案

如果在Windows Vista或更高版本上,请尝试通过右键单击并说以管理员身份运行"来打开SQL Server Management Studio.正如Mitch提到的那样,这可能只是权限问题.然后尝试附加到数据库.

If on Windows Vista or higher, try opening SQL Server Management Studio by right clicking and saying "Run as Administrator". As Mitch mentioned maybe it is just a permissions issue. Then try attaching to the database.

这篇关于SQL Server无法打开Visual Studio创建的数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆