public Excel(string filename, bool HDR, OledbVersions oledbVer) { string connStr = string.Empty; if (oledbVer == OledbVersions.OLEDB40) { connStr = string.Format( "Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties='Excel 8.0;HDR={1};'", filename, HDR ? "YES" : "NO"); } else if (oledbVer == OledbVersions.OLEDB12) { connStr = string.Format( "Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=\"Excel 12.0;HDR={1};IMEX=1\"", filename, HDR ? "YES" : "NO"); } Trace.WriteLine("Excel.ctor: connection string: " + connStr); _conn = new OleDbConnection(connStr); _conn.Open(); }
public Excel(string filename, OledbVersions oledbVer) : this(filename, false, oledbVer) { }