I created a database using Server Explorer Visual Studio of name MyDatabase.mdf (and MyDatabase.ldf). Now i want to delete it.I deleted it from Visual Studio using Server Explorer (means removed reference). Then i deleted MyDatabase.mdf and MyDatabase.ldf files from my C directory (C:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL). But when i try creating a new database with same name (MyDatabase), it gives an error and says, database name alrea开发者_StackOverflowdy exists, try some other name.
There are probably metabase attributes still left in your master table referencing your deleted tables. Instead of just deleting the MDF and LDF files, I would recommend using T-SQL DROP DATABASE
statements. If you have MS SQL Management Studio, you could also right-click on your database and choose the "Delete" option.
Are you creating a User Instance of the database? If so, remove the "Initial Catalog" parameter from the connection string in the solution in Visual Studio if you have it defined.
精彩评论