-1

I followed the following MDSN tutorial:

http://www.asp.net/mvc/tutorials/mvc-4/getting-started-with-aspnet-mvc4/adding-a-model

Then I tried this guide according to my needs and I set up a database GAMES.MDF.

Then, I deleted the database and set it up again, is supposedly work (I can write and read data), but there is no such database in the APP_DATA folder. It seems to exist, but somewhere else on my PC.   I even tried a new project and it did not work, works but not in the library, and it even uses the data I created before. I even deleted the DB from SQL Server Management Studio 2008.

How do I delete it permanently, not to remain any trace of it?

Kev
  • 118,037
  • 53
  • 300
  • 385
Idotz
  • 11

2 Answers2

0

Check for the connection string in the web.config - You'll probably see the file location there.

SimSimY
  • 3,616
  • 2
  • 30
  • 35
0

Your connection string should ideally name the database you want to use. I would not recommend specifying the MDF file, unless you know you are using SQL Express. Source: https://social.msdn.microsoft.com/Forums/sqlserver/en-US/f21c0728-935d-492a-baaf-ff2704e3683b/attachdbfilename-option-in-connection-string?forum=sqldataaccess0

Instead, this is how it is done on SQL Server:

initial catalog=MyDatabase

To be sure you are accessing the database you think you are, run this SQL query through your app, using your connection string, and look at the physical file location of your MDF file. This query is handy for knowing which DB is tied to which DB files.

select * from [dbo].[database_files]

As far as actually clearing the DB, this article deals with managing database initializers and seeds. You might be experiencing a problem due to that: How to delete and recreate from scratch an existing EF Code first database

Outside of EF, SQL deletes databases like this:

use master
drop database MyDatabase
Community
  • 1
  • 1
Jeff R
  • 459
  • 6
  • 18