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. Image for the cookie policy date

Assign Data Table as Data Source to Pivot Grid

Sir
   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.
 
Regards
T.Ashokraj
 
 

5 Replies

SA Solai A L Syncfusion Team 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,

AL.Solai.


Attachment: CS_20729d43.zip


AS Ashokraj May 20, 2014 11:41 AM UTC

Thanks AL.Solai. Its working perfectly




SA Solai A L Syncfusion Team 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,

AL.Solai.

 



PR pravin December 9, 2014 11:49 AM UTC

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


NK Neelakandan Kannan Syncfusion Team 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”.

C#:

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");

con.Open();

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

DataTable dt = new DataTable();

adp.Fill(dt);

return dt;

}

Please let me know if you have any concerns.

 

Regards,

Neelakandan


Attachment: Sample_Pivot_Stored_Procedures_acb28582.zip

Loader.
Live Chat Icon For mobile
Up arrow icon