C# 如何打开 *.sdf 文件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2375118/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
how to open *.sdf files?
提问by Gold
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?
我曾经用visual-studio打开sdf(sqlCE)文件?或 sql 服务器?我真的不记得了。现在我无法打开这个 sdf 文件。我需要用什么程序打开它?
采纳答案by ctacke
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.
它是一个 SQL Compact 数据库。您需要定义“打开”的含义。您可以使用 SqlCeConnection 通过代码打开它,以便您可以编写自己的工具/应用程序来访问它。
Visual Studio can also open the files directlyif was created with the right version of SQL Compact.
如果使用正确版本的 SQL Compact 创建,Visual Studio 也可以直接打开文件。
There are also some third-party toolsfor manipulating them.
还有一些第三方工具可以操作它们。
回答by Phil Ross
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.
除了@ctacke 描述的方法之外,您还可以使用 SQL Server Management Studio 打开 SQL Server Compact Edition 数据库。您将需要 SQL Server 2008 才能打开 SQL CE 3.5 数据库。
回答by Chris Voon
Try LINQPad, it works for SQL Server, MySQL, SQLite and also SDF (SQL CE 4.0). Best of all it's free!
试试LINQPad,它适用于 SQL Server、MySQL、SQLite 和 SDF (SQL CE 4.0)。最重要的是它是免费的!
Steps with version 4.35.1:
版本 4.35.1 的步骤:
click 'Add Connection'
Click Next with 'Build data context automatically' and 'Default(LINQ to SQL)' selected.
Under 'Provider' choose 'SQL CE 4.0'.
Under 'Database' with 'Attach database file' selected, choose 'Browse' to select your .sdf file.
Click 'OK'.
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?
点击“添加连接”
单击下一步并选择“自动构建数据上下文”和“默认(LINQ to SQL)”。
在“提供者”下选择“SQL CE 4.0”。
在选择了“附加数据库文件”的“数据库”下,选择“浏览”以选择您的 .sdf 文件。
单击“确定”。
瞧!它应该以 .sdf 格式显示表格,并且能够通过右键单击表格或使用您喜欢的 .NET 语言甚至 SQL 编写 LINQ 代码来查询它。多么酷啊?
回答by user_v
You can use SQL Compact Query Analyzer
您可以使用 SQL Compact 查询分析器
http://sqlcequery.codeplex.com/
http://sqlcequery.codeplex.com/
SQL Compact Query Analyzer is really snappy. 3 MB download, requires an install but really snappy and works.
SQL Compact 查询分析器真的很活泼。3 MB 下载,需要安装,但非常快速且有效。