首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在XML配置文件和数据库表之间保持值同步?

如何在XML配置文件和数据库表之间保持值同步?
EN

Stack Overflow用户
提问于 2012-12-10 22:47:06
回答 1查看 388关注 0票数 0

我是以层次化的方式构建的。举个例子。

代码语言:javascript
复制
Category 7
    Objective 7.1  [GeneralExpectation='']
        A  [Expectation='']
        B  [Expectation='']
        C  [Expectation='']
    Objective 7.2  [GeneralExpectation='']
        A  [Expectation='']
        B  [Expectation='']
    Objective 7.3  [GeneralExpectation='']
        A  [Expectation='']
Category 8
    ...

我想将此信息存储在xml文件中而不是存储在数据库中会更方便。

代码语言:javascript
复制
<Levels>
  <Level Id=7>
    <Categories>
      <Category Id=1 Name="Numbers, Operations, and Quantitative Reasoning" Expectation="The student will demonstrate an understanding of numbers, operations, and quantitative reasoning.">
        <Objective Id="7.1" Name="Number, operation, and quantitative reasoning." GeneralExpectation="The student represents and uses numbers in a variety of equivalent forms. The student is expected to">
          <SubObjective Id="A" Expectation="compare and order integers and positive rational numbers; Supporting Standard" />
          <SubObjective Id="B" Expectation="convert between fractions, decimals, whole numbers, and percents mentally, on paper, [or with a calculator]; and Readiness Standard" />
        </Objective>
      </Category>
      <Category Id=2 Name="Patterns, Relationships, and Algebraic Reasoning" Expectation="The student will demonstrate an understanding of patterns, relationships, and algebraic reasoning.">
      </Category>
    </Categories>
  </Level>
</Levels>

我这样做是因为我需要在WPF中的TreeView控件中访问此信息。但同时,我的SQL数据库中有一个表,其中需要存储用户正在使用的级别目标:7.1A, 7.1B, 7.1C, 7.2A

这是一个好的实践吗?否则我不会保留这两个数据之间的关系。

EN

回答 1

Stack Overflow用户

发布于 2012-12-11 00:28:56

@DarfZon,我会将数据保存为一种格式(如果您的其他数据也是关系型的,我建议使用SQL Server )。您可以使用SQL Server强大的XML语法和FOR XML子句以分层格式检索SQL Server中的关系数据。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13803243

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档