无法将表格优于数据表格

时间:2013-08-21 08:46:05

标签: asp.net

我无法将excel表读取到方向发生变化的数据表中 作为excel表的参考我试图在asp.net上传

我附上了

的图片 我正在上传

表单,因为你可以看到集线器位置,区域,位置列没有定向因此数据表无法获得结果

sheet i am uploading as u can see hub location column is not oriented So data table is not able to get the results

要获得更多帮助,我甚至可以上传生成的上述Excel表格的数据表格

enter image description here

enter image description here

1 个答案:

答案 0 :(得分:0)

OleDbCommand cmd = new OleDbCommand("SELECT * FROM [Sheet1$]", oledbConn); 
OleDbDataAdapter oleda = new OleDbDataAdapter(); 
oleda.SelectCommand = cmd; 
DataSet ds = new DataSet();
oleda.Fill(ds, "XLData");
ExcelSheetData = ds.Tables[0];

试试这个,因为您需要提供源表的名称以用于表映射。