There is already a database with the same name, or the supplied file cannot be accessed, or it is on a UNC share. What does this imply?

asp.net c# database entity-framework

Question

I Build an ASP.NET project with PL,BL,DAl, BE of Entity Data Model(=.edmx) which I generated from a service Based DB (= .mdf) which is located in my DAL project.

I did copied the connectionString from the BE app.config to the PL web.config

what's wrong? why I get this error:

System.Data.SqlClient.SqlException: An attempt to attach an auto-named database for file C:\Documents and Settings\user\שולחן העבודה\למידה אישית\Lev\Lev\App_Data\Midrasha.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.

my code logic is PL->BL->DAL- > try to save the new object to the DB. the code line which generate the problem is :

public void AddFeedback(Feedback feed)
{
    MidrashaEntities _context = new MidrashaEntities();
    _context.Feedback.AddObject(feed);
    _context.SaveChanges();  <-------throw the exception
}

Feedback is a table in my DAL's SQL which I generate as Object entity.

1
2
1/24/2012 12:01:38 PM

Popular Answer

I had the same error before My Error before in the Connection String so make sure you have the right Connection String

2
10/29/2012 2:44:33 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow