Hi,
Iam using Sql 2000 as Back End
Iam attaching Database at runtime.
I have used foll code to attach database:
vConn.ConnectionString = "Data source=Localhost;uid=" + UID + ";pwd=" + UPWD + ";database=Demo;AttachDbFileName=|DataDirectory|Demo.MDF;";
But while running code it giving me foll error:
Device activation error. The physical file name 'C:\Documents and Settings\admin\Desktop\Demo\Demo\bin\Debug\Demo.MDF' may be incorrect.
Could not attach database 'Demo' to file 'C:\Documents and Settings\admin\Desktop\Demo\Demo\bin\Debug\Demo.MDF'.
Plz help me out!
Loading


Madhu KRank #1,514 · 1.1K reputationPosted Dec 21, 2010, 2:08 AM EST
Pravin GhadgeRank #1,340 · 1.3K reputationPosted Dec 21, 2010, 2:59 AM EST
But i dont know hw 2 check permissions for accessing the file.
Madhu KRank #1,514 · 1.1K reputationPosted Dec 21, 2010, 3:18 AM EST
Suthish NairRank #92 · 22.8K reputationPosted Dec 22, 2010, 1:13 AM EST
Sam HobbsRank #107 · 20.5K reputationPosted Dec 22, 2010, 1:57 AM EST
Note that there are two folders with the name "Demo". That is possible and it can work and there is nothing wrong with that if you want that, but it seems suspicious to me. It might not be the correct path for your project.
Suthish NairRank #92 · 22.8K reputationPosted Dec 23, 2010, 10:12 PM EST
Your query resolved?
Pravin GhadgeRank #1,340 · 1.3K reputationPosted Dec 24, 2010, 1:39 AM EST
I have check path but it is correct
Pravin GhadgeRank #1,340 · 1.3K reputationPosted Dec 24, 2010, 1:41 AM EST
My querry is not resolved
Suthish NairRank #92 · 22.8K reputationPosted Dec 24, 2010, 8:19 PM EST
Move it to the Project folder.
Sam HobbsRank #107 · 20.5K reputationPosted Dec 24, 2010, 8:43 PM EST
The connection string is using "|DataDirectory|", which is very normal. The problem is that the rules for determining what that means (what that directory is) is quite complicated. I think it is very normal for it to be the debug directory for the project, so if the path and filename for the mdf file are correct, the problem must be something not shown here. I just don't know where to look, but I think it is best to first ensure that the path and filename are correct.