public ProductAndCategory MultipleResultSets()
        {
            ProductAndCategory ret = new ProductAndCategory();

            // Reset all properties
            Reset();

            // Create SQL to select from multiple tables
            SQL  = "SELECT * FROM SalesLT.Product;";
            SQL += "SELECT * FROM SalesLT.ProductCategory;";

            // Execute Query
            DataSet ds = GetDataSet();

            // Build products list
            ret.Products = ToList <Product>(ds.Tables[0]);

            // Build categories list
            ret.Categories = ToList <ProductCategory>(ds.Tables[1]);

            // Set RowsAffected
            RowsAffected = ret.Products.Count + ret.Categories.Count;

            return(ret);
        }
        public virtual ProductAndCategory MultipleResultSets()
        {
            ProductAndCategory ret = new ProductAndCategory();

            // Reset all properties
            Reset();

            // Create SQL to select from multiple tables
            SQL  = "SELECT * FROM SalesLT.Product;";
            SQL += "SELECT * FROM SalesLT.ProductCategory;";

            // Execute Query
            using (IDataReader dr = GetDataReader()) {
                // Use reflection to load Product data
                ret.Products = ToList <Product>(dr);
                RowsAffected = ret.Products.Count;

                // Move to next result set
                dr.NextResult();

                // Use reflection to load ProductCategory data
                ret.Categories = ToList <ProductCategory>(dr);
                RowsAffected  += ret.Categories.Count;
            }

            return(ret);
        }