0

the wpf application save the sql compact database at a path like this: C:\Users\NOURHAN\AppData\Local\Apps\2.0\Data\59KZ6KD9.COJ\VHH739C4.V9L\dr_h..tion_3ae2203d6bcb251a_0001.0000_e052c665d8e18ffa\Data\data

the path folder names changes from pc to another

at the connection string it connect to database properly using : connectionString="Data Source=|DataDirectory|\db.sdf"

but I want to copy database file ,so I want to get the database path

I tried to use : System.Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);

but it isn't reach to the exact path

any help please?

user36894
  • 1
  • 1
  • Did you try http://stackoverflow.com/questions/938421/getting-the-applications-directory-from-a-wpf-application? – Shaun Apr 11 '15 at 17:47
  • yes,I tried it's get the exe app directory and it's different from the database directory – user36894 Apr 11 '15 at 18:07

1 Answers1

0

It sounds like you're using ClickOnce and I believe the method you are seeking is ApplicationDeployment.DataDirectory (see this MSDN documentation).

Shaun
  • 140
  • 6