在创建SQL模式时需要帮助 [英] need help in creating SQL Schema

查看:121
本文介绍了在创建SQL模式时需要帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我下面有一个来自系统的示例数据,

I have below sample data from a system,

表X

Col_Name                      DataType

Col_Name                DataType

 系统名称           字符串

 systemName            string

  SystemVersion          十进制

 SystemVersion         Decimal

  SubmitedOn                  日期时间

 SubmitedOn             DateTime

现在,我要通过C#中的上述数据在XML下创建

Now, I m creating below XML by above data in C#,

< Source_XML>

<Source_XML>

  < SystemName Value =时间表";名称=""/</SystemName>

  <SystemName Value="Timesheet" Name=""></SystemName>

  < SystemVersion Value ="1.0"名称=""/</SystemVersion>

  <SystemVersion Value="1.0" Name=""></SystemVersion>

  < SubmitedOn Value ="2010年8月31日";名称="/"/SubmitedOn>

  <SubmitedOn Value="08/31/2010" Name=""></SubmitedOn>

</Source_XML>

</Source_XML>

  现在,我需要使用C#为上述XML准备XML SCHEMA,并在SQL 2005中进行注册...,这样我们就可以在上述XML上进行验证了.

  Now I need to prepare XML SCHEMA for above XML by C# and register the same in SQL 2005...so that nxt time we can validate above XML.

请有人建议我如何实现上述功能....在运行时通过C#创建架构,并将相同的架构注册到SQL 2005数据库中.

Please someone suggest me how to do above functionality....creating schema at runtime by C# and register the same schema into SQL 2005 database.

谢谢

推荐答案

您可以使用executenonquery创建表.

You can use the executenonquery to create a table.

这是显示如何创建表的行.

Here is a lin that shows how to create a table.

http://www.java2s.com/Code/CSharp/Database-ADO.net/UseExecuteNonQuerytorunDDLstatementscreatetable.htm

在数据库中创建表之后.

Once the table is created in the database.

您可以使用数据集的writeschema方法来编写模式.

you can use the writeschema method of the dataset to write the schema.

ADO.NET数据集提供了将其内容写为XML或直接通过它的WriteXml或WriteXmlSchema方法作为Schema.使用FileStream,您可以 将输出捕获到平面文件.最近,我不得不执行此操作来创建与Infragistics Ultrawingrid控件一起使用的数据源架构.

The ADO.NET DataSet provides the ability to write its contents out as XML or as a Schema directly through it's WriteXml or WriteXmlSchema methods. Using a FileStream, you can capture the output to a flat file. I recently had to do this to create a datasource schema for use with a Infragistics ultrawingrid control.

这是显示如何编写模式的链接.

here is link that shows how to write the schema.

http://samgaut.blogspot.com/2008/01/use-dataset-writeschema-method.html

该方法也可用于数据表.

The method is also availabe for datatable.

 

 


这篇关于在创建SQL模式时需要帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆