I want read the table name " check " in sheet 2 but it always show error missing operator. How can i fix it.
Here is my code public DataTable ReadExcel(string fileName, string fileExt) { string conn = string.Empty; DataTable dtexcel = new DataTable(); if (fileExt.CompareTo(".xls") == 0) conn = @"provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + fileName + ";Extended Properties='Excel 8.0;HRD=Yes;IMEX=1';"; else conn = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + fileName + ";Extended Properties='Excel 12.0;HDR=Yes;IMEX=1';"; using (OleDbConnection con = new OleDbConnection(conn)) { try { OleDbDataAdapter oleAdpt = new OleDbDataAdapter("select Check * from [Sheet2$] ", con); oleAdpt.Fill(dtexcel); } catch(Exception ex) { MessageBox.Show(ex.Message.ToString()); } } return dtexcel; }