如何绑定DevExpress PivotGridControl到数据库

如何绑定DevExpress PivotGridControl到数据库,第1张

事例数据库如下: 代码如下: C# using DevExpressLookAndFeel; using DevExpressXtraPivotGrid; using SystemDataOleDb; // Create a connection object OleDbConnection connection = new OleDbConnection("Provider=MicrosoftJetOLEDB40;Data Source=C:\\DB\\NWINDMDB"); // Create a data adapter OleDbDataAdapter adapter = new OleDbDataAdapter("SELECT FROM SalesPerson", connection); // Create and fill a dataset DataSet sourceDataSet = new DataSet(); adapterFill(sourceDataSet, "SalesPerson"); // Assign the data source to the XtraPivotGrid control pivotGridControl1DataSource = sourceDataSetTables["SalesPerson"]; // Create a row PivotGridControl field bound to the Country datasource field PivotGridField fieldCountry = new PivotGridField("Country", PivotAreaRowArea); // Create a row PivotGridControl field bound to the Sales Person datasource field PivotGridField fieldCustomer = new PivotGridField("Sales Person", PivotAreaRowArea); fieldCustomerCaption = "Customer"; // Create a column PivotGridControl field bound to the OrderDate datasource field PivotGridField fieldYear = new PivotGridField("OrderDate", PivotAreaColumnArea); fieldYearCaption = "Year"; // Group field values by years fieldYearGroupInterval = PivotGroupIntervalDateYear; // Create a column PivotGridControl field bound to the CategoryName datasource field PivotGridField fieldCategoryName = new PivotGridField("CategoryName", PivotAreaColumnArea); fieldCategoryNameCaption = "Product Category"; // Create a filter PivotGridControl field bound to the ProductName datasource field PivotGridField fieldProductName = new PivotGridField("ProductName", PivotAreaFilterArea); fieldProductNameCaption = "Product Name"; // Create a data PivotGridControl field bound to the 'Extended Price' datasource field PivotGridField fieldExtendedPrice = new PivotGridField("Extended Price", PivotAreaDataArea); fieldExtendedPriceCellFormatFormatType = DevExpressUtilsFormatTypeNumeric; // Specify the formatting setting to format summary values as integer currency amount fieldExtendedPriceCellFormatFormatString = "c0"; // Add the fields to the control's field collection pivotGridControl1FieldsAddRange(new PivotGridField[] {fieldCountry, fieldCustomer, fieldCategoryName, fieldProductName, fieldYear, fieldExtendedPrice}); // Arrange the row fields within the Row Header Area fieldCountryAreaIndex = 0; fieldCustomerAreaIndex = 1; // Arrange the column fields within the Column Header Area fieldCategoryNameAreaIndex = 0; fieldYearAreaIndex = 1; // Customize the control's look-and-feel via the Default LookAndFeel object UserLookAndFeelDefaultUseWindowsXPTheme = false; UserLookAndFeelDefaultStyle = LookAndFeelStyleSkin; UserLookAndFeelDefaultSkinName = "Money Twins"; VB Imports DevExpressLookAndFeel Imports DevExpressXtraPivotGrid Imports SystemDataOleDb ' Create a connection object Dim connection As OleDbConnection = New OleDbConnection("Provider=MicrosoftJetOLEDB40;Data Source=C:\\DB\\NWINDMDB") ' Create a data adapter Dim adapter As OleDbDataAdapter = New OleDbDataAdapter("SELECT FROM SalesPerson", connection) ' Create and fill a dataset Dim sourceDataSet As DataSet = New DataSet adapterFill(sourceDataSet, "SalesPerson") ' Assign the data source to the XtraPivotGrid control PivotGridControl1DataSource = sourceDataSetTables("SalesPerson") ' Create a row PivotGridControl field bound to the Country datasource field Dim fieldCountry As PivotGridField = New PivotGridField("Country", PivotAreaRowArea) ' Create a row PivotGridControl field bound to the Sales Person datasource field Dim fieldCustomer As PivotGridField = New PivotGridField("Sales Person", PivotAreaRowArea) fieldCustomerCaption = "Customer" ' Create a column PivotGridControl field bound to the OrderDate datasource field Dim fieldYear As PivotGridField = New PivotGridField("OrderDate", PivotAreaColumnArea) fieldYearCaption = "Year" ' Group field values by years fieldYearGroupInterval = PivotGroupIntervalDateYear ' Create a column PivotGridControl field bound to the CategoryName datasource field Dim fieldCategoryName As PivotGridField = New PivotGridField("CategoryName", PivotAreaColumnArea) fieldCategoryNameCaption = "Product Category" ' Create a filter PivotGridControl field bound to the ProductName datasource field Dim fieldProductName As PivotGridField = New PivotGridField("ProductName", PivotAreaFilterArea) fieldProductNameCaption = "Product Name" ' Create a data PivotGridControl field bound to the 'Extended Price' datasource field Dim fieldExtendedPrice As PivotGridField = New PivotGridField("Extended Price", PivotAreaDataArea) fieldExtendedPriceCellFormatFormatType = DevExpressUtilsFormatTypeNumeric ' Specify the formatting setting to format summary values as integer currency amount fieldExtendedPriceCellFormatFormatString = "c0" ' Add the fields to the control's field collection PivotGridControl1FieldsAddRange(New PivotGridField() {fieldCountry, fieldCustomer, _ fieldCategoryName, fieldProductName, fieldYear, fieldExtendedPrice}) ' Arrange the row fields within the Row Header Area fieldCountryAreaIndex = 0 fieldCustomerAreaIndex = 1 ' Arrange the column fields within the Column Header Area fieldCategoryNameAreaIndex = 0 fieldYearAreaIndex = 1 ' Customize the control's look-and-feel via the Default LookAndFeel object UserLookAndFeelDefaultUseWindowsXPTheme = False UserLookAndFeelDefaultStyle = LookAndFeelStyleSkin UserLookAndFeelDefaultSkinName = "Money Twins"

dev

1 系统周边设备

写得蛮好的linux学习笔记_卡门

/boot/initrd 核心解压缩所需 RAM Disk

/dev 系统周边设备

/etc 系统相关设定文件

hibaiducom- 基于77个网页

2 偏差

石油英语词汇(D2)[cibobiz整理]

Deutsche Mark 德国马克

dev 偏差

dev 仪器

>

alter table dev_news_con

alter column body MEDIUMTEXT

dev_news_con是表名吗?sql数据库是这样就行

以上就是关于如何绑定DevExpress PivotGridControl到数据库全部的内容,包括:如何绑定DevExpress PivotGridControl到数据库、Dev是什么意思、修改数据库dev_news_con的body字段由text改为MEDIUMTEXT等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/sjk/9352184.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-27
下一篇 2023-04-27

发表评论

登录后才能评论

评论列表(0条)

保存