コード例 #1
0
ファイル: Excel.cs プロジェクト: kkcn-git/Egode
        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();
        }
コード例 #2
0
ファイル: Excel.cs プロジェクト: kkcn-git/Egode
 public Excel(string filename, OledbVersions oledbVer) : this(filename, false, oledbVer)
 {
 }