我下面有一个来自系统的示例数据,
I have below sample data from a system,
表X
Col_Name DataType
Col_Name DataType
系统名称字符串
systemNamestring
SystemVersion十进制
SystemVersionDecimal
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.
www.java2s/Code/CSharp/Database-ADO/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.
samgaut.blogspot/2008/01/use-dataset-writeschema-method.html
该方法也可用于数据表.
The method is also availabe for datatable.
更多推荐
在创建SQL模式时需要帮助
发布评论