We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Assign Data Table as Data Source to Pivot Grid

Thread ID:





116303 May 13,2014 12:07 PM UTC Dec 11,2014 04:25 AM UTC WinForms 5
Tags: PivotGridControl
Asked On May 13, 2014 12:07 PM UTC

   I want to bind Data table as data source to Pivot grid . and also i am retriving data's for data table from sql stored procedures. 
, pleas give me the sample source. Also i want to know different type of data source options.

Solai A L [Syncfusion]
Replied On May 19, 2014 05:42 PM UTC

Hi Ashok,

Thank you for your interest in Syncfusion products.

We have prepared a pivot grid sample with a Data Table.With this you use SQL stored procedure as per your requirement. Kindly refer the below provided sample implementing your requirement.

Please let us know if you have any other concerns.

Thanks & Regards,


Attachment: CS_20729d43.zip

Replied On May 20, 2014 11:41 AM UTC

Thanks AL.Solai. Its working perfectly

Solai A L [Syncfusion]
Replied On May 21, 2014 04:39 AM UTC

Hi Ashok,

Thanks for the update.

Please let us know if you have any other further concerns.

Thanks & Regards,



Replied On December 9, 2014 11:49 AM UTC

i  want to bind datatable to pivotegrid using stored procedure.please post using stored procedure

Neelakandan Kannan [Syncfusion]
Replied On December 11, 2014 04:25 AM UTC

Hi Pravin,


Thank you for your update.

We would like to suggest you to convert the Sql database(or any other Stored procedure) to DataTable. so that we can easily assign the data source to the pivot grid. Please refer the below code snippet we used in our sample. We also like to let you know that we have to use the System.Data.SqlServerCe.dll assembly to run this sample. We have also attached the dll in the below sample. We have used a sample database file named “NorthWind.sdf”.


this.pivotGridControl1.ItemSource = GetsData();

// Adding PivotRows to the Control

this.pivotGridControl1.PivotRows.Add(new PivotItem { FieldMappingName = "City", TotalHeader = "Total" });

this.pivotGridControl1.PivotRows.Add(new PivotItem { FieldMappingName = "Last Name", TotalHeader = "Total" });

// Adding PivotColumns to the Control

this.pivotGridControl1.PivotColumns.Add(new PivotItem { FieldMappingName = "Country", TotalHeader = "Total" });

// Adding PivotCalculations to the Control

this.pivotGridControl1.PivotCalculations.Add(new PivotComputationInfo { FieldName = "Extension", Format = "C", SummaryType = SummaryType.DoubleTotalSum });

public DataTable GetsData()


SqlCeConnection con = new SqlCeConnection("Data Source = E:\\DB\\Northwind.sdf; Password = Hebot15v");


SqlCeDataAdapter adp = new SqlCeDataAdapter("SELECT \n\t[Employees].[Employee ID]\n\t,[Employees].[Last Name]\n\t,[Employees].[First Name]\n\t,[Employees].[Title]\n\t,[Employees].[Birth Date]\n\t,[Employees].[Hire Date]\n\t,[Employees].[Address]\n\t,[Employees].[City]\n\t,[Employees].[Region]\n\t,[Employees].[Postal Code]\n\t,[Employees].[Country]\n\t,[Employees].[Home Phone]\n\t,[Employees].[Extension]\n\t,[Employees].[Photo]\n\t,[Employees].[Notes]\n\t,[Employees].[Reports To]\n FROM \n\t[Employees]", con);

DataTable dt = new DataTable();


return dt;


Please let me know if you have any concerns.




Attachment: Sample_Pivot_Stored_Procedures_acb28582.zip


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon