Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

database error

Posted on 2014-01-06
3
203 Views
Last Modified: 2014-01-20
Hi,

i am using entity frame work datafirst and my connection string contains as follow


  <add name="DefaultConnection" providerName="System.Data.SqlClient"
connectionString="Data Source=(LocalDb)\v11.0;
Initial Catalog=aspnet-Core.Portal-20131125172348;
Integrated Security=SSPI;
AttachDBFilename=|DataDirectory|\aspnet-Core.Portal-20131125172348.mdf" />  



now i am getting following error


Cannot attach the file

'D:\Halcyon\Projects\GymTrainer\Trunk\Core.Portal\
App_Data\aspnet-Core.Portal-20131125172348.mdf'
 
as database 'aspnet-Core.Portal-20131125172348'.


could you please say me how to resolve it. most of sites saying to delete database,

but don't we have any other solution with out deleting it.
0
Comment
Question by:praveen1981
3 Comments
 
LVL 22

Expert Comment

by:Ivo Stoykov
ID: 39761415
Look here and here. Hope you'll find a solution.

HTH

Ivo Stoykov
0
 
LVL 3

Accepted Solution

by:
13Shadow earned 500 total points
ID: 39762220
Can you debug it and see that indeed your =|DataDirectory| is indeed resolving to 'D:\Halcyon\Projects\GymTrainer\Trunk\Core.Portal\
App_Data ?
0
 

Author Closing Comment

by:praveen1981
ID: 39796138
Thanks
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question