c# - How to get the directory of database? -
i using microsoft database inside c:\wpf1\wpfapplication1\wpfapplication1
folder. when update database updates 1 inside c:\wpf1\wpfapplication1\wpfapplication1\bin\debug
don't want.
how folder c:\wpf1\wpfapplication1\wpfapplication1
without typing full name?
the directory c:\wpf1\wpfapplication1\wpfapplication1
project directory - 1 source code in, not directory application aware of or work (for example if application installed pc directory won't exist).
the usual approach when working databases or dependent files either:
- put file in other common location (such in folder on
c:
drive) - just have application work copy of file in output (
bin\debug\
) directory, i.e. directory application installed - can change properties of item in solution have item copied output directory, either time or when item in solution directory newer:
if really want use c:\wpf1\wpfapplication1\wpfapplication1
directory way assume directory 2 higher current working directory:
path.getfullpath(path.combine(environment.currentdirectory, "..\\.."));
this of course makes 2 horrible assumptions, first current directory directory .exe contained in, , secondly directory want 2 higher directory - recommend find way sort of logic highly unlikely work on end-users pc.
Comments
Post a Comment