View Code
1
DataSet dateSet
=
outManage.GetAllAudit();
//
从数据库中得到dateset
2 DataTable table = dateSet.Tables[ 0 ]; // 保存在table中
3 DataTable NewTable = new DataTable(); // 建立一个新table
4 foreach (DataColumn column in table.Columns)
5 {
6 NewTable.Columns.Add(column.ColumnName, column.DataType); // 循环把table中的列名和列名的类型添加到Newtable中
7 }
8 for ( int i = 0 ; i < table.Rows.Count; i ++ )
9 {
10 object [] objs = table.Rows[i].ItemArray; // 创建object类型的数组,把需要保存的行,添加在数组中
11 NewTable.Rows.Add(objs); // 把数组添加到Newtable
12 }
2 DataTable table = dateSet.Tables[ 0 ]; // 保存在table中
3 DataTable NewTable = new DataTable(); // 建立一个新table
4 foreach (DataColumn column in table.Columns)
5 {
6 NewTable.Columns.Add(column.ColumnName, column.DataType); // 循环把table中的列名和列名的类型添加到Newtable中
7 }
8 for ( int i = 0 ; i < table.Rows.Count; i ++ )
9 {
10 object [] objs = table.Rows[i].ItemArray; // 创建object类型的数组,把需要保存的行,添加在数组中
11 NewTable.Rows.Add(objs); // 把数组添加到Newtable
12 }