开发者

SQL Compact C# .... Couple of Questions

开发者 https://www.devze.com 2022-12-18 04:59 出处:网络
I have a few questions regarding Compact SQL. I am using VS C# 2008 Express by the way. 1) Are there any GUI tools for creating and managing the databases?

I have a few questions regarding Compact SQL. I am using VS C# 2008 Express by the way.

1) Are there any GUI tools for creating and managing the databases?

2) Once the DB is created, and the app is released, would the app have开发者_运维知识库 to create the database each time the user installs it? Or can I create the database and include it with the app? I ask because the database will never change, but the data included is large.

3) Are relationships possible with SQL CE i.e. Forign Keys, 1 to many ...


1 & 3 answered by Oded.

2) I include an empty SQL Compact Edition Database as a emended resource. When it's time to create the Database I use this code:

using (FileStream fs = File.Open(fileName, FileMode.OpenOrCreate))
{
    BinaryWriter sw = new System.IO.BinaryWriter(fs);
    sw.Write(Template.TemplateDatabase); // Autogenerated: the Embedded Resource
    fs.Flush();
    fs.Close();
}


  1. SSMS Express is a free download. It is the Sql Server Management Studio from microsoft.

  2. You can bundle SQL Express with your application if needed and setup the database as part of installation.

  3. "SQL CE supports transactions, referential integrity constraints" - from WikiPedia.

0

精彩评论

暂无评论...
验证码 换一张
取 消