Cannot attach the file *.mdf as database

后端 未结 22 1905
猫巷女王i
猫巷女王i 2020-11-27 14:22

Basically I\'ve followed a tutorial and decided to delete the .mdf file afterwards.

Now whenever I try to run the application I get the following error

22条回答
  •  佛祖请我去吃肉
    2020-11-27 14:56

    I have faced the same issue. The following steps in VS 2013 solved the problem for me:

    1. In Server Explorer add new Connect to Database
    2. Select Microsoft SQL Server Database File as Data source
    3. Choose database filename as it should be in according to connection string in your web.config
    4. New database file was created and two database connections was appeared in Server Explorer: "MyDatabaseName" and "MyDatabaseName (MyProjectName)"
    5. Delete one connection (I've deleted "MyDatabaseName")

提交回复
热议问题