原創(chuàng)|其它|編輯:郝浩|2012-10-17 17:29:20.000|閱讀 284 次
概述:數(shù)據(jù)查看一直是我們的常規(guī)應(yīng)用,那么DevExpress是如何在運(yùn)行時(shí)查看Adventure Works多維數(shù)據(jù)集數(shù)據(jù)的呢?下面,我們就給出一個(gè)具體代碼事例供大家參考.
# 界面/圖表報(bào)表/文檔/IDE等千款熱門(mén)軟控件火熱銷(xiāo)售中 >>
數(shù)據(jù)查看一直是我們的常規(guī)應(yīng)用,那么DevExpress是如何在運(yùn)行時(shí)查看Adventure Works多維數(shù)據(jù)集數(shù)據(jù)的呢?下面,我們就給出一個(gè)具體代碼事例供大家參考:
C#
using DevExpress.XtraPivotGrid;
// Create a PivotGridControl. 
PivotGridControl pivotControl = new PivotGridControl();
pivotControl.Dock = DockStyle.Fill;
this.Controls.Add(pivotControl);
// Specify the connection string 
pivotControl.OLAPConnectionString = "Provider=msolap;Data Source=localhost;Initial Catalog=Adventure Works DW;Cube Name=Adventure Works;";
// Create fields. 
PivotGridField fieldMeasuresInternetSalesAmount = new PivotGridField("[Measures].[Internet Sales Amount]", PivotArea.DataArea);
fieldMeasuresInternetSalesAmount.Caption = "Internet Sales Amount";
PivotGridField fieldCustomerCountryCountry = new PivotGridField("[Customer].[Country].[Country]", PivotArea.RowArea);
fieldCustomerCountryCountry.Caption = "Country";
PivotGridField fieldDateFiscalYearFiscalYear = new PivotGridField("[Date].[Fiscal Year].[Fiscal Year]", PivotArea.ColumnArea);
fieldDateFiscalYearFiscalYear.Caption = "Fiscal Year";
// Add fields to the PivotGridControl 
pivotControl.Fields.AddRange(new PivotGridField[] { fieldMeasuresInternetSalesAmount, fieldCustomerCountryCountry,
    fieldDateFiscalYearFiscalYear });
VB
Imports DevExpress.XtraPivotGrid
' Create a PivotGridControl. 
Dim pivotControl As PivotGridControl = New PivotGridControl()
pivotControl.Dock = DockStyle.Fill
Me.Controls.Add(pivotControl)
' Specify the connection string 
pivotControl.OLAPConnectionString = "Provider=msolap;Data Source=localhost;Initial Catalog=Adventure Works DW;Cube Name=Adventure Works;" 
' Create fields. 
Dim fieldMeasuresInternetSalesAmount As PivotGridField = New PivotGridField("[Measures].[Internet Sales Amount]", PivotArea.DataArea)
fieldMeasuresInternetSalesAmount.Caption = "Internet Sales Amount" 
Dim fieldCustomerCountryCountry As PivotGridField = New PivotGridField("[Customer].[Country].[Country]", PivotArea.RowArea)
fieldCustomerCountryCountry.Caption = "Country" 
Dim fieldDateFiscalYearFiscalYear As PivotGridField = New PivotGridField("[Date].[Fiscal Year].[Fiscal Year]", PivotArea.ColumnArea)
fieldDateFiscalYearFiscalYear.Caption = "Fiscal Year" 
' Add fields to the PivotGridControl 
pivotControl.Fields.AddRange(New PivotGridField() {fieldMeasuresInternetSalesAmount, fieldCustomerCountryCountry, _
    fieldDateFiscalYearFiscalYear})
	
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請(qǐng)務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請(qǐng)郵件反饋至chenjj@ke049m.cn
文章轉(zhuǎn)載自:慧都控件網(wǎng)