how to open *.sdf files?

C#Visual Studio-2008Sql Server-Ce

C# Problem Overview


I used to open sdf (sqlCE) files with visual-studio? or sql-server? I really don't remember. Now I can't open this sdf file. With what program do I need to open it?

C# Solutions


Solution 1 - C#

Try LINQPad, it works for SQL Server, MySQL, SQLite and also SDF (SQL CE 4.0). Best of all it's free!

LINQPad

Steps with version 4.35.1:

  1. click 'Add Connection'

  2. Click Next with 'Build data context automatically' and 'Default(LINQ to SQL)' selected.

  3. Under 'Provider' choose 'SQL CE 4.0'.

  4. Under 'Database' with 'Attach database file' selected, choose 'Browse' to select your .sdf file.

  5. Click 'OK'.

  6. Voila! It should show the tables in .sdf and be able to query it via right clicking the table or writing LINQ code in your favorite .NET language or even SQL. How cool is that?

Solution 2 - C#

It's a SQL Compact database. You need to define what you mean by "Open". You can open it via code with the SqlCeConnection so you can write your own tool/app to access it.

Visual Studio can also open the files directly if was created with the right version of SQL Compact.

There are also some third-party tools for manipulating them.

Solution 3 - C#

You can use SQL Compact Query Analyzer

https://github.com/christianhelle/sqlcequery

SQL Compact Query Analyzer is really snappy. 3 MB download, requires an install but really snappy and works.

Solution 4 - C#

In addition to the methods described by @ctacke, you can also open SQL Server Compact Edition databases with SQL Server Management Studio. You'll need SQL Server 2008 to open SQL CE 3.5 databases.

Solution 5 - C#

If you simply need to view the table and run queries on it you can use this third party sdf viewer. It is a lightweight viewer that has all the basic functionalities and is ready to use after install.

and ofcourse, its Free.

Solution 6 - C#

It can be opened using Visual Studio 2012.Follow the below path in VS after opening the project. View->Server Explorer->

enter image description here

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionGoldView Question on Stackoverflow
Solution 1 - C#Chris VoonView Answer on Stackoverflow
Solution 2 - C#ctackeView Answer on Stackoverflow
Solution 3 - C#user_vView Answer on Stackoverflow
Solution 4 - C#Phil RossView Answer on Stackoverflow
Solution 5 - C#Nikhil SahuView Answer on Stackoverflow
Solution 6 - C#Hameed SyedView Answer on Stackoverflow