Answered by:
how to bind data in pivot table

Question
-
i am working on C# form and Have axPivotTable Control.
for Databinding i am Using This Code
SqlConnection cn=new SqlConnection("database=durdu;user id=sa;pwd=");
SqlDataAdapter cmd=new SqlDataAdapter ("select * from marksheet",cn);
DataTable dt=new DataTable();
cmd.Fill(dt);
axPivotTable1.DataSource=(msdatasrc.DataSource)(object)dt;
this throws an error -specified cast is not valid.
i have done lots of googling and does not found single satisfied answer
please tell me how to bind data to a pivot table
Please Provide me full code how to use axpivot table control with c# form
its very urgent .<b>- Moved by jack 321 Friday, July 25, 2008 5:59 AM axPivotTable Control usage is not a C# general question (Moved from Visual C# General to Off-Topic Posts (Do Not Post Here))
Wednesday, July 23, 2008 3:58 PM
Answers
-
Hi,
Thank you for your post! I would suggest posting your question in one of the MS Forums,
MSDN Forums » SQL Server » SQL Server Data Access
located here: http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=87&SiteID=1
Have a great day!- Proposed as answer by Shrikant Maske Thursday, November 13, 2008 7:08 AM
- Marked as answer by Shrikant Maske Monday, March 23, 2009 11:19 AM
Thursday, November 13, 2008 7:08 AM
All replies
-
Hi,
Thank you for your post! I would suggest posting your question in one of the MS Forums,
MSDN Forums » SQL Server » SQL Server Data Access
located here: http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=87&SiteID=1
Have a great day!- Proposed as answer by Shrikant Maske Thursday, November 13, 2008 7:08 AM
- Marked as answer by Shrikant Maske Monday, March 23, 2009 11:19 AM
Thursday, November 13, 2008 7:08 AM -
Try If consql.State = ConnectionState.Closed Then consql.Open() End If cmdsql.Connection = consql cmdsql.CommandText = "select s.Id,s.SrNo,p.ProductName,s.Quantity,s.Price,s.Amount from Sales_Detail s,Products p where s.ProductID=p.ProductID" 'select * from Products dasql.SelectCommand = cmdsql dasql.Fill(salesdt) If consql.State = ConnectionState.Open Then consql.Close() End If pv.CommandText = "select * from Sales_Detail" pv.ConnectionString = "Provider=SQLOLEDB;Data Source=KNS57;User ID=sa;Password=sa1985;Initial Catalog=Northwind;" pv.Refresh() Catch ex As Exception If consql.State = ConnectionState.Open Then consql.Close() End If End TryTuesday, August 4, 2009 8:53 AM
-
TryIf consql.State = ConnectionState.Closed Thenconsql.Open()End Ifcmdsql.Connection = consqlcmdsql.CommandText = "select s.Id,s.SrNo,p.ProductName,s.Quantity,s.Price,s.Amount from Sales_Detail s,Products p where s.ProductID=p.ProductID" 'select * from Productsdasql.SelectCommand = cmdsqldasql.Fill(salesdt)If consql.State = ConnectionState.Open Thenconsql.Close()End If'pv = axPivotTable1pv.CommandText = "select * from Sales_Detail"pv.ConnectionString = "Provider=SQLOLEDB;Data Source=KNS57;User ID=sa;Password=sa1985;Initial Catalog=Northwind;"pv.Refresh()Catch ex As ExceptionIf consql.State = ConnectionState.Open Thenconsql.Close()End IfEnd TryTuesday, August 4, 2009 8:54 AM