How to: Create a Cross-Tab Report (Runtime Sample)

C# VB

using System; using System.Data; using System.Data.OleDb; using System.Windows.Forms; using DevExpress.XtraPivotGrid; using DevExpress.XtraReports.UI; using DevExpress.XtraReports.UI.PivotGrid; // ...  private void button1_Click(object sender, EventArgs e) {     // Create a cross-tab report.     XtraReport report = CreateReport();      // Show its Print Preview.     report.ShowPreview(); }  private XtraReport CreateReport() {     // Create a blank report.     XtraReport rep = new XtraReport();      // Create a detail band and add it to the report.     DetailBand detail = new DetailBand();     rep.Bands.Add(detail);      // Create a pivot grid and add it to the Detail band.     XRPivotGrid pivotGrid = new XRPivotGrid();     detail.Controls.Add(pivotGrid);      // Create a data connection.     OleDbConnection connection = new         OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=..\\..\\nwind.mdb");      // Create a data adapter.     OleDbDataAdapter adapter = new         OleDbDataAdapter("SELECT CategoryName, ProductName, Country, [Sales Person],          Quantity, [Extended Price] FROM SalesPerson", connection);      // Creata a dataset and fill it.     DataSet dataSet1 = new DataSet();     adapter.Fill(dataSet1, "SalesPerson");       // Bind the pivot grid to data.     pivotGrid.DataSource = dataSet1;     pivotGrid.DataMember = "SalesPerson";      // Generate pivot grid's fields.     XRPivotGridField fieldCategoryName =          new XRPivotGridField("CategoryName", PivotArea.RowArea);     XRPivotGridField fieldProductName =          new XRPivotGridField("ProductName", PivotArea.RowArea);     XRPivotGridField fieldCountry =          new XRPivotGridField("Country", PivotArea.ColumnArea);     XRPivotGridField fieldSalesPerson =          new XRPivotGridField("Sales Person", PivotArea.ColumnArea);     XRPivotGridField fieldQuantity =          new XRPivotGridField("Quantity", PivotArea.DataArea);     XRPivotGridField fieldExtendedPrice =          new XRPivotGridField("Extended Price", PivotArea.DataArea);      // Add these fields to the pivot grid.     pivotGrid.Fields.AddRange(new PivotGridField[] {fieldCategoryName,           fieldProductName, fieldCountry, fieldSalesPerson, fieldQuantity,           fieldExtendedPrice});      return rep; }  
时间: 2024-10-24 18:32:49

How to: Create a Cross-Tab Report (Runtime Sample)的相关文章

How to Create a Framework for iOS[RE]

In the previous tutorial, you learned how to create a reusable knob control. However, it might not be obvious how to make it easy for other developers to reuse it. One way to share it would be to provide the source code files directly. However, this

Vim7中的Tab功能

Vim7中新增加了Tab功能,即命令前缀 tab.在新建窗口的命令前增加 tab 即可在新的Tab中打开窗口. :tab new # 在新Tab中建立新文件 :tab new sample.txt # 在新Tab中打开sample.txt 快捷键: gt # 切换Tab <数字>gt # 切换到指定的Tab 详细内容可以通过以下命令查看帮助. :h :tab

How to Install and Configure Zabbix on Ubuntu 16.04

By Hitesh Jethva, Alibaba Cloud Tech Share Author Introduction Zabbix is an open source and enterprise-class network monitoring tool that can be used to monitor performance and availability of the server, network devices and other network components.

Kettle访问IDH2.3中的HBase

摘要 Kettle是一款国外开源的ETL工具,纯java编写,可以在Window.Linux.Unix上运行,绿色无需安装,数据抽取高效稳定.big-data-plugin是kettle中用于访问bigdata,包括hadoop.cassandra.mongodb等nosql数据库的一个插件. 截至目前,kettle的版本为4.4.1,big-data-plugin插件支持cloudera CDH3u4.CDH4.1,暂不支持Intel的hadoop发行版本IDH. 本文主要介绍如何让kettl

iPhone Development – core data relationships tutorial part 1

I'm going to start a short series on Core Data relationships and maybe throw in some general Core Data stuff too. Here in part one we're just going to set our app up with core data and add two entities with a simple one to one relationship between th

C#4.0初探:dynamic 关键字

C#新增了dynamic关键字,正因为这一个小小的关键字,C#动态特性向前迈进了一大步.dynamic是一个类型关键字,声明为dynamic的类型与"静态类型"(这里的静态类型是指编译时确定的类型,下同)相比最大的特点它是"动态类型",它会运行时尝试调用方法,这些方法的存在与否不是在编译时检查的,而是在运行时查找,如果方法存在并且参数正确,会正常调用,否则会抛出Microsoft.CSharp.RuntimeBinder.RuntimeBinderException

Android系统Gps分析(一)

1 GPS架构 2 GPS分析 2.1 头文件 头文件定义在:hardware/libhardware/include/hardware/gps.h,定义了GPS底层相关的结构体和接口 GpsLocation GPS位置信息结构体,包含经纬度,高度,速度,方位角等. [cpp] view plaincopy /** Flags to indicate which values are valid in a GpsLocation. */   typedef uint16_t GpsLocatio

如何开发Chrome扩展程序

         前两篇谈到了Chrome扩展,但是感觉没有说清楚,这次在丰富一下.其实很简单,如果你懂得基本的HTML.CSS.JavaScript,那你就有了扩展Chrome浏览器需要的所有知识. 开始    为了着手创建你的扩展程序,你只需要为你的扩展创建一个文件夹.程序所必须的文件只有manifest.json.,不过也推荐准备一些图片用作图标,和至少一个JavaScript以提供功能.一般来说还会包含HTML文档.样式表.图片等等其他的资源. Manifest文件        每个扩

PostgreSQL 9.6 水平分库,还差一点点啦

PostgreSQL 持续在基于fdw的sharding技术上深耕,9.6开始,在符合条件的前提下,支持JOIN和SORT下推到数据节点执行.下面是一个测试创建几个shard库 for subfix in 0 1 2 3 do psql -c "create database db$subfix" done 创建master库 psql -c "create database master;" psql master -c "create extensio