private void Form2_Load(object sender, EventArgs e) { DataSet ds=ExcelToDS(@"C:\Documents and Settings\qqq\桌面\002.xls"); int x = ds.Tables.Count; System.Data.DataTable dt = new System.Data.DataTable(); dt.Columns.AddRange( new DataColumn[]{ new DataColumn("col1",typeof(string)), new DataColumn("col2",typeof(string)), new DataColumn("col3",typeof(string)), new DataColumn("col4",typeof(string)), new DataColumn("col5",typeof(string)), new DataColumn("col6",typeof(string)), new DataColumn("col7",typeof(string)), new DataColumn("col8",typeof(string)), new DataColumn("col9",typeof(string)), new DataColumn("col10",typeof(string)), new DataColumn("col11",typeof(string)), new DataColumn("col12",typeof(string)), new DataColumn("col13",typeof(string)), new DataColumn("col14",typeof(string)) }); |