Click here to Skip to main content
15,867,330 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Im using a Sdf file as my database file and I address this sdf file in the App.config using this connectionStrings tag:

XML
<connectionStrings><add name="ReviewsDBConnection" connectionString="data source=&quot;E:\Google Drive\bin\Debug\Data\ReviewsDB.sdf&quot;;password=123" providerName="System.Data.SqlServerCe.4.0" /></connectionStrings>


But whenever I move my project (the whole solution) to another PC, I get an error which says the ReviewsDB.sdf file path is not correct. What should I write for data source that won't need to be changed when I move the solution to another PC? I'm using Telerik Open Access to get access to database.
Posted
Updated 20-Feb-15 5:36am
v2
Comments
Richard MacCutchan 20-Feb-15 11:40am    
Then you need to fix the path. Have you actually checked the full path on the other PC to see that it is correct?
Saman With You 20-Feb-15 12:54pm    
Yeah, That's the point. The paths are different. Actually I don't want to create the same path every time I move the project to another pc. I just want to copy the solution somewhere each time ,open and run it.
Richard MacCutchan 20-Feb-15 12:58pm    
Then don't use Google drive, use a standard location on the PC.
PIEBALDconsult 20-Feb-15 11:40am    
Better to put it in the User's data directory ( %APPDATA% ) or the common data directory ( %ProgramData% )
Saman With You 20-Feb-15 12:51pm    
Do I need to copy the sdf file to APPDATA manually each time I move the solution to another PC?

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