数据库已经存在。选择上使用CreateDatabase不同的名称() [英] Database already exist. Choose a Different Name using CreateDatabase()

查看:1237
本文介绍了数据库已经存在。选择上使用CreateDatabase不同的名称()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题,在...

I got an issue and learned something at the same time....

我创建了从现有服务器数据库中的DBML的同时学到了一些东西。

I created a DBML from an existing server database.

这是我想创造本地数据库(一个.mdf文件)的DBML。我创建的数据库使用DataContext.CreateDatabase(C:\xxxx.mdf)

From the DBML I wanted to create local database (an .mdf file). I created the database using DataContext.CreateDatabase("C:\xxxx.mdf") .

然后我决定把它删除(手动,这是evidentally一件坏事),因为当我尝试重新创建具有相同名称的数据库(eventhough文件被删除) ,我得到的数据库已经存在的错误。选择上使用CreateDatabase()一个不同的名称

Then I decided to delete it (MANUALLY, which is a bad thing evidentally) because when I try to recreate the database with the same name (eventhough the files are deleted), I get the error Database already exist. Choose a Different Name using CreateDatabase()

我试图通过注册表ooking,没有运气......我试图寻找该文件的整个硬盘。 。没有运气。

I tried ooking through the registry, no luck... I tried searching the whole hard drive for the file.. no luck.

谷歌搜索后,我发现你删除与的CreateDatabase()创建了一个数据库 DeleteDatabase() ....然后你可以再重新创建数据库。

After googling, I found that you delete a database that was created with CreateDatabase() with DeleteDatabase().... Then you can recreate the database again.

好问题是,现在我依然因为系统认为该名称已存在无法重新创建旧的数据库。

Well problem is, now I still can't recreate the old database because the system thinks the name already exists.

有没有摆脱旧DATABSE文件的reminents的不存在

Is there a way to get rid of the reminents of the old databse file the "does not exist"

推荐答案

您需要打开通过在Visual Studio 服务器资源管理器数据库(添加新连接+选择数据库),然后添加一个新建查询键入 DROP DATABASE XXXX 并执行它。您还可以使用 SQL Server管理套件。

You need to open master database via server explorer in Visual Studio (Add New Connection + Select master database) then add a New query, type Drop Database xxxx and execute it. You can also use Sql Server Management Studio.

这篇关于数据库已经存在。选择上使用CreateDatabase不同的名称()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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