简体   繁体   中英

Unable to excel sheet into datatable

I am unable to read excel sheet to data table which has change in orientation for reference of excel sheet i am trying to upload in asp.net

i have attached image below

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

我正在上传工作表,因为您可以看到中心位置列未定向,因此数据表无法获取结果

For more help i am even uploading the generated DATA TABLE IMAGE of above excel sheet

在此处输入图片说明

在此处输入图片说明

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];

Try this, because you need to give Name of the source table to use for table mapping.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM