Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
meet_binay
Starting Member
10 Posts |
Posted - 2013-06-16 : 11:19:02
|
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
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2013-06-16 : 12:43:21
|
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? |
|
|
meet_binay
Starting Member
10 Posts |
Posted - 2013-06-17 : 00:00:17
|
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 correctI 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"/> |
|
|
|
|
|