SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 SQL Server Administration (2008)
 Accessing database from debug folder shows error
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

meet_binay
Starting Member

India
10 Posts

Posted - 06/16/2013 :  11:19:02  Show Profile  Reply with Quote
Hi, I am trying to access the .mdf data base file from the debug folder.
connection string with "|DataDirectory|" is able to find the data base file but error shows as follows:-

"could not open new data base <database name>.
create database is aborted.
can not attach file "<complete path of data base in debug folder>"
as database <database name>

physical file name <database log file> may be in correct

James K
Flowing Fount of Yak Knowledge

3555 Posts

Posted - 06/16/2013 :  12:43:21  Show Profile  Reply with Quote
How are you trying to attach the database - i.e., what are the steps you are going through? Are you doing it through SSMS? Is the database already attached to an instance of SQL Server?
Go to Top of Page

meet_binay
Starting Member

India
10 Posts

Posted - 06/17/2013 :  00:00:17  Show Profile  Reply with Quote
I have detached the databse from sql server and copied .mdf and .ldf file to the debug folder.
In the connection string i am using

<add key="ConnectionString" value="Data Source=.\SQLExpress;Integrated Security=True;User Instance=True;AttachDbFilename=|DataDirectory|\WORK_ACCT_MGMT.mdf;Initial Catalog=WORK_ACCT_MGMT"/>

It is showing error
"could not open new data base <database name>.
create database is aborted.
can not attach file "<complete path of data base in debug folder>"
as database <database name>
physical file name <database log file> may be in correct

I had tried this method earlier and it was working same as when the database is attached to sql and the coonection string is as follows
<add key="ConnectionString" value="Data Source=USER;Initial Catalog=GT_HT_DB;Integrated Security=True"/>

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000