I have a code-first ASP.NET MVC app that ran smoothly and was able to access the data from SQL Server until I copied the project over to another location and opened it from there. 

I get the following errors:

> 
> System.Data.DataException  
> 
>  HResult=0x80131501  
> 
>  Message=An exception occurred while initializing the database. See the InnerException for details.  
> 
>  Source= 
> 
> 
> StackTrace:  
> 
> 
> 
> 
> Inner Exception 1:  
> 
>  EntityException: The underlying provider failed on Open.
> 
> 
> Inner Exception 2:  
> 
>  SqlException: Database 'C:\Users\BICHE\Desktop\FinalCSharpChallenge\FinalCSharpChallenge\App\_Data\StudentContextDB.mdf' already exists. Choose a different database name.  
> 
>  Cannot attach the file 'C:\Users\BICHE\Desktop\MY REPOS3\The-Tech-Academy-C-Coding-Project\FinalCSharpChallenge\FinalCSharpChallenge\App\_Data\StudentContextDB.mdf' as database 'StudentContextDB'.
> 
> 
> 

My questions are: why does this happen just because I moved the project from my desktop to another location on my computer? 

Can this be solved by making an "if" statement that proceeds to use the `StudentContextDB` if it exists, and creates it if it doesn't? (My instructor suggested this, so I'm thinking I will try this first)

Lastly, if this is the right solution, what would be the syntax for that particular statement? I've seen instructions for Drop and Create, but not Use or Create.

I appreciate any insight people may have on this issue!