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.
Unfortunately, activation email could not send to your email. Please try again.

Assign Data Table as Data Source to Pivot Grid

Thread ID:





116303 May 13,2014 08:07 AM Dec 10,2014 11:25 PM Windows Forms 5
Tags: PivotGridControl
Asked On May 13, 2014 08:07 AM

   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 01:42 PM

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 07:41 AM

Thanks AL.Solai. Its working perfectly

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

Hi Ashok,

Thanks for the update.

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

Thanks & Regards,



Replied On December 9, 2014 06:49 AM

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

Neelakandan Kannan [Syncfusion]
Replied On December 10, 2014 11:25 PM

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.

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.