Revit.SDK.Samples.RoomSchedule.XlsDBConnector.XlsDBConnector C# (CSharp) Method

XlsDBConnector() public method

Class constructor, to retrieve data from .xls data source
public XlsDBConnector ( String strXlsFile ) : System
strXlsFile String The .xls file to be connected. /// This file should exist and it can be writable.
return System
        public XlsDBConnector(String strXlsFile)
        {
            // Validate the specified
            if (!ValidateFile(strXlsFile)) {
                throw new ArgumentException("The specified file doesn't exists or has readonly attribute.", strXlsFile);
            }

            // establish a connection to the data source.
            m_connectStr = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = \"" + strXlsFile +
                "\"; Extended Properties = \"Excel 8.0;HDR=YES;\"";

            // create the .xls connection
            m_objConn = new System.Data.OleDb.OleDbConnection(m_connectStr);
            m_objConn.Open();
        }