user2897388
user2897388

Reputation: 85

How to create a datatable in xsd file using c#

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

Upvotes: 0

Views: 4156

Answers (1)

Rajesh
Rajesh

Reputation: 26

Create a 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");

Upvotes: 1

Related Questions