This is my code
OleDbCommand cmdExcel = new OleDbCommand();
OleDbDataAdapter oda = new OleDbDataAdapter();
DataTable dtable = new DataTable();
cmdExcel.CommandText = SELECT Name,EmailID,PhoneNumber From [Sheet1$]
oda.SelectCommand = cmdExcel;
oda.Fill(dtable);
This one working fine but
SELECT Name,EmailID,Phone Number From [Sheet1$] ... not working
I'm trying with SELECT "Name","EmailID","Phone Number" From [Sheet1$] but not working properly...
Try this
cmdExcel.CommandText = "SELECT Name,EmailID,PhoneNumber AS [Phone Number]
FROM [Sheet1$]";
OR
cmdExcel.CommandText = "SELECT Name,EmailID,[Phone Number] AS PhoneNumber
FROM [Sheet1$]";