How to copy table structure from defaultview.table?

cYn

New Member
I have created a datatable with three columns. I am sorting the data \[code\]DataTable dt= new DataTable();DataColumn auto = new DataColumn("ID",typeof(System.Int32)); dt.Columns.Add(auto); auto.AutoIncrement = true; auto.AutoIncrementSeed = 1; auto.ReadOnly = true; dt.PrimaryKey = new DataColumn[] { dt.Columns["ID"] }; dt.Columns.Add(new DataColumn("Name")); dt.Columns.Add(new DataColumn("Precedence",typeof(System.Int32))); DataView dv = dt.DefaultView; dv.Sort = "Precedence ASC"; dt=dv.table\[/code\]dv.table doesnot return me table structure of original table.I want the sorted data and the table schema(primary key) as well.
 
Back
Top