/// <summary>
 /// Constructor that creates QueryRowSet with set number of items.
 /// </summary>
 /// <param name="cur">FormOA.ICommenceCursor reference.</param>
 /// <param name="nCount">Number of items to query.</param>
 /// <param name="rcwpub">RCWReleasePublisher object used for COM Interop object cleanup.</param>
 /// <param name="flags">option flags, must be 0.</param>
 internal CommenceQueryRowSet(FormOA.ICommenceCursor cur, int nCount, IRcwReleasePublisher rcwpub, CmcOptionFlags flags)
 {
     // queryrowset with set number of rows
     _qrs = cur.GetQueryRowSet(nCount, (int)flags);
     if (_qrs == null)
     {
         throw new CommenceCOMException("Unable to obtain a QueryRowSet from Commence.");
     }
     _rcwReleasePublisher             = rcwpub;
     _rcwReleasePublisher.RCWRelease += this.RCWReleaseHandler;
 }
 /// <summary>
 /// Constructor that creates QueryRowSet with all items.
 /// </summary>
 /// <param name="cur">FormOA.ICommenceCursor reference.</param>
 /// <param name="rcwpub">RCWReleasePublisher object used for COM Interop object cleanup.</param>
 /// <param name="flags">option flags, must be 0.</param>
 internal CommenceQueryRowSet(FormOA.ICommenceCursor cur, IRcwReleasePublisher rcwpub, CmcOptionFlags flags)
 {
     // queryrowset with all rows
     try
     {
         _qrs = cur.GetQueryRowSet(cur.RowCount, (int)flags);
     }
     catch (Exception)
     {
         // swallow all exceptions and throw our own.
     }
     if (_qrs == null)
     {
         throw new CommenceCOMException("Unable to obtain a QueryRowSet from Commence.");
     }
     _rcwReleasePublisher             = rcwpub;
     _rcwReleasePublisher.RCWRelease += this.RCWReleaseHandler;
 }
        /// <summary>
        /// Constructor that creates QueryRowSet for particular row identified by RowID.
        /// </summary>
        /// <param name="cur">FormOA.ICommenceCursor reference.</param>
        /// <param name="pRowID">row or thid  id.</param>
        /// <param name="rcwpub">RCWReleasePublisher object used for COM Interop object cleanup.</param>
        /// <param name="flags">option flags, must be 0.</param>
        /// <param name="identifier"><see cref="RowSetIdentifier"/></param>
        internal CommenceQueryRowSet(FormOA.ICommenceCursor cur, string pRowID, IRcwReleasePublisher rcwpub, CmcOptionFlags flags = CmcOptionFlags.Default, RowSetIdentifier identifier = RowSetIdentifier.RowId)
        {
            switch (identifier)
            {
            case RowSetIdentifier.RowId:
                _qrs = cur.GetQueryRowSetByID(pRowID, (int)flags);
                break;

            case RowSetIdentifier.Thid:
                // _qrs = cur.GetQueryRowSetByThid(pRowID, (int)flags);
                throw new NotSupportedException("GetQueryRowSetByThid no longer supported by Commence API");
                //break;
            }
            if (_qrs == null)
            {
                throw new CommenceCOMException("Unable to obtain a QueryRowSet from Commence.");
            }
            _rcwReleasePublisher             = rcwpub;
            _rcwReleasePublisher.RCWRelease += this.RCWReleaseHandler;
        }