private DataTable GetData(string reportId, out string errorMessage) { // Request the Metadata var metaDataResponse = SendRequest(new MetaDataRequest(reportId).ToXmlElement(), out errorMessage); if (metaDataResponse != null) { var metaData = new MetaDataResponse(metaDataResponse); { DataTable dt = new DataTable(); metaData.Columns.ForEach(c => dt.Columns.Add(c)); for (int pageNum = 1; pageNum <= metaData.PageCount; pageNum++) { // Get each page of the data var dataResponse = SendRequest(new DataRequest(reportId, pageNum).ToXmlElement(), out errorMessage); if (dataResponse != null) { var data = new DataResponse(dataResponse); foreach (var row in data.Rows) { var dataRow = dt.NewRow(); for (int colNum = 0; colNum < row.Count; colNum++) { dataRow[colNum] = row[colNum]; } dt.Rows.Add(dataRow); } } } return(dt); } } return(null); }
private DataTable GetData( string reportId, out string errorMessage ) { // Request the Metadata var metaDataResponse = SendRequest( new MetaDataRequest( reportId ).ToXmlElement(), out errorMessage ); if ( metaDataResponse != null ) { var metaData = new MetaDataResponse( metaDataResponse ); { DataTable dt = new DataTable(); metaData.Columns.ForEach( c => dt.Columns.Add( c ) ); for ( int pageNum = 1; pageNum <= metaData.PageCount; pageNum++ ) { // Get each page of the data var dataResponse = SendRequest( new DataRequest( reportId, pageNum ).ToXmlElement(), out errorMessage ); if ( dataResponse != null ) { var data = new DataResponse( dataResponse ); foreach ( var row in data.Rows ) { var dataRow = dt.NewRow(); for ( int colNum = 0; colNum < row.Count; colNum++ ) { dataRow[colNum] = row[colNum]; } dt.Rows.Add( dataRow ); } } } return dt; } } return null; }