Hi all
in my app i am providing path using Environment.SpecialFolder.ApplicationData for my connection string,
i.e: string filePath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\TestFolder\" + "test.sdf";
and its returning the following path :
"C:\Users\sumitk\AppData\Roaming\TestFolder\test.sdf";
and its working fine for my window C# app.
same like this if i use Environment.SpecialFolder.ApplicationData in my window service for accessing the database its giving me the following path
"C:\Windows\system32\config\systemprofile\AppData\Roaming\TestFolder\test.sdf"
due to this i am not able to access my database through window service and its giving me below error :
" Check the directory for the database. [ Path = C:\Windows\system32\config\systemprofile\AppData\Roaming\TestFolder\test.sdf ]"
so plz tell me how can i access the same path through my window service which is i am getting from my C#app
sumitk
Sumit KumawatPosted Oct 30, 2012, 12:26 AM
thanx for your reply but if i used fixed static path for my setup then i will have another problem suppose i gv static path for E:\testfolder\xyz.sdf for my database and at client machine E drive doesn't exist then this will cause of error.
how will i overcome by this .
Sivaraman DhamodaranPosted Oct 29, 2012, 9:12 AM
C:\Users\sumitk\AppData\Roaming
And Working folder for the Service is:
C:\Windows\system32\config\systemprofile\AppData\Roaming
In stead of using the Environment.SpecialFolder.ApplicationData use a specific fixed path and copy your .sdf file there.