Пример #1
0
        /// <summary>List the columns in a SQLITE database table</summary>
        /// <param name="dbName">Database file name</param>
        /// <param name="tableName">Database table name</param>
        /// <returns>Array of database column names</returns>  
        /// <exception cref="System.ArgumentException">Throws an argument exception if dbName or tableName are not supplied</exception>
        public static String[] DBColumns(String dbName, String tableName)
        {
            //Tidy up input parameters
            dbName = dbName.Trim();
            tableName = tableName.Trim();

            //Fail if dbName or tableName not passed in
            if (dbName == String.Empty)
                throw new ArgumentException("database name required", "dbName");
            if (tableName == String.Empty)
                throw new ArgumentException("table name required", "tableName");

            //Get the list of column names for the specified table
            DBEngineBase db = new SQLiteDBEngine(dbName);
            return db.columns(tableName);
        }