none
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>

    • Déplacé jack 321 vendredi 25 juillet 2008 05:59 axPivotTable Control usage is not a C# general question (Moved from Visual C# General to Off-Topic Posts (Do Not Post Here))
    mercredi 23 juillet 2008 15:58

Réponses

Toutes les réponses

  •  

    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!

    jeudi 13 novembre 2008 07:08
  • 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 Try
    mardi 4 août 2009 08:53
  •  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 = axPivotTable1
      
              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 Try
    mardi 4 août 2009 08:54