//if (strFileExtension.Trim() == ".xls") //{ // //ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + FILENAME + ";Extended Properties=\"Excel 8.0;HDR=YES;IMEX=1;MAXSCANROWS=0;\""; // ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + FILENAME + ";Extended Properties=\"Excel 8.0;IMEX=1;HDR=Yes;TypeGuessRows=0;ImportMixedTypes=Text\""; // //ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + FILENAME + ";Extended Properties=Excel 8.0;"; //} //else if (strFileExtension.Trim() == ".xlsx") //{ // ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + FILENAME + ";Extended Properties=\"Excel 12.0;IMEX=1;HDR=Yes;TypeGuessRows=0;ImportMixedTypes=Text;\""; //} if (strFileExtension == ".xls") { ConnectionString = "Provider=Microsoft.ACE.OLEDB.8.0;Data Source=" + FILENAME + @";Extended Properties=" + Convert.ToChar(34).ToString() + @"Excel 8.0;Imex=1;HDR=Yes;" + Convert.ToChar(34).ToString(); } else if (strFileExtension == ".xlsx") { ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + FILENAME + @";Extended Properties=" + Convert.ToChar(34).ToString() + @"Excel 12.0;Imex=1;HDR=Yes;" + Convert.ToChar(34).ToString(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)