1

Unable to upload excel file again once it is uploaded recently

 string OleDBconstring = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + filepath + ";Extended Properties=\"Excel 12.0;HDR=YES;\"";            
            OleDbConnection OleDBcon = new OleDbConnection(OleDBconstring + "");
            OleDBcon.Open();`enter code here`
            DataTable objSheetNmDt = OleDBcon.GetSchema("Tables");

            DataTable objExcelDt;
            objExcelDt = new DataTable();
            string sqlquery = "Select * From  [" + objSheetNmDt.Rows[0]["TABLE_NAME"].ToString() + "]";//[{0}]                   
            OleDbCommand objCm`enter code here`d = new OleDbCommand(sqlquery, OleDBcon);
            OleDbDataAdapter da = new OleDbDataAdapter();
            da.SelectCommand = objCmd;
            da.Fill(objExcelDt);
Dmitry Bychenko
  • 180,369
  • 20
  • 160
  • 215

0 Answers0