Cannot attach the file *.mdf as database

后端 未结 22 1911
猫巷女王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:51

    Just change database name from web.config project level file and then update database.

    connectionString = Data Source =(LocalDb)\MSSQLLocalDB;AttachDbFilename="|DataDirectory|\aspnet-Project name-20180413070506.mdf";Initial Catalog="aspnet--20180413070506";Integrated

    Change the bold digit to some other number:

    connectionString = Data Source==(LocalDb)\MSSQLLocalDB;AttachDbFilename="|DataDirectory|\aspnet-Project name-20180413070507.mdf";Initial Catalog="aspnet--20180413070507";Integrated

提交回复
热议问题