0

I'm building an C#-application that uses an SQL Server Compact 4.0 database (.sdf) with Entity Framework for data. I want to be able to load/save-files from within this application so that the user can load a different database or backup the database to an USB eg.

I know you can create an sdf in code, but how can i load it at runtime (The connectionstring)?

My question is that this must be a common thing to do, what is the best way to go about it? is there any guides out there to do this?

or do you reccomend another way to go about my problem?

//ObjectiveCoder

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Objective Coder
  • 557
  • 3
  • 11
  • 23
  • Maybe this reply http://stackoverflow.com/questions/2433934/opening-an-sql-ce-file-at-runtime-with-entity-framework-4 – ErikEJ Dec 28 '11 at 15:51

1 Answers1

0

You should use a SqlCeConnectionStringBuilder to create a connection string containing your file path.

SLaks
  • 868,454
  • 176
  • 1,908
  • 1,964