Beispiel #1
0
        /// <summary>
        /// Constructor that creates a view given a database handle and a query.
        /// </summary>
        /// <param name="db">Handle to the database to run the query on.</param>
        /// <param name="query">Query to be executed.</param>
        public View(Database db, string query)
        {
            if (null == db)
            {
                throw new ArgumentNullException("db");
            }

            if (null == query)
            {
                throw new ArgumentNullException("query");
            }

            uint handle = 0;

            int error = MsiInterop.MsiDatabaseOpenView(db.Handle, query, out handle);

            if (0 != error)
            {
                throw new MsiException(error);
            }

            this.Handle = handle;
        }