Click here to Skip to main content
15,896,557 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,
I am trying to inset data into my database file *.sdf
So, if i have the .sdf file in d:\projects\MyWPF\App_Data\Mydb.sdf
Ideally What shall be my connection string.

Ideally is this path correct:
|DataDirectory|\App_Data\Mydb.sdf

If i am building my application in Debug mode: then in my bin folder i have App_data\MyDb.sdf that is getting updated and my original file in
d:\projects\MyWPF\App_Data\Mydb.sdf is sometime not getting updated properly.

Everyehere i have given the connection string as |DataDirectory|\App_Data\Mydb.sdf only

CAn anyone pls let me know where i am going wrong??
Posted

1 solution

Um...D:\Projects\MyWPF\ is very unlikely to be your data directory - and it's very, very likely to cause problems in production when installed on another machine - because your app will be in the "Program Files" folder and writing that that is either difficult or impossible for security reasons.

Have a look at this: Where should I store my data?[^] - it suggests some better places which would be appropriate for development and release.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900