如何使用C#在XSD文件中创建数据表 [英] How to create a datatable in xsd file using c#

查看:264
本文介绍了如何使用C#在XSD文件中创建数据表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要通过在xsd文件中编写代码来创建数据表,而不是通过在xsd文件中使用exixing数据表来创建数据。当右键单击xsd文件---添加---数据表时。
但是我不想使用它,我想编写一些代码来创建数据表。
我不知道要解决这个问题,请帮助解决这个问题。
谢谢

I need to create a datatable by writing code in xsd file not by using exixting datatable in xsd file.when right click on xsd file---Add---Datatable. But I don't want to use this,I want to write some code for creating the datatable. I am not getting idea to solve this problem,please help in solving this. Thanks

推荐答案

创建 DataTable

DataTable dt = new DataTable();

dt.TableName = "Sample";

dt.Columns.Add("Column1");
dt.Columns.Add("Column2");
dt.Columns.Add("Column3");
dt.Columns.Add("Column4");

dt.WriteXmlSchema(@"D:Project1\example.xsd");

这篇关于如何使用C#在XSD文件中创建数据表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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