0
Ich möchte Daten an Pivot-Raster mit Code nicht von SqlDataSource binden.Wie binden Sie Daten an Pivot-Raster in WinForms mit C# -Code in WinForms?
private void Report_Summary_Load(object sender,EventArgs e)
{
string cs= configuraitonManager.connectionString["connectionStringDatabase"].connectionString;
using(SqlConnection con = new SqlConnection(cs))
{
SqlCommand cmd = new SqlCommand("spStoredProcedureTest",con);
cmd.CommandType = CommandType.StoredProcedure;
con.open();
SqlDataReader sda = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
sda.Fill(ds);
pivotGrid.DataSource = ds;
PivotGridField Name = new PivotGridField("Name",PivotArea.RowArea);
PivotGrid.Fields.AddRange(new PivotGridField[] {Name});
Name.AreaIndex = 0;
// My pivot grid name is "pivotGridDemo"
//How to bind the data to the data area,column area and Row area
}
}
Ich habe 5 Felder
Namen, Standard, Stadt, Alter, DobYear
I Namen und Stadt in Zeilenbereich, Stadt in Spaltenbereich, setzen will Alter und DobYear in Datenbereich
Aktualisiert
Der oben genannte Code lautet . Name ist Row field. Aber nicht die Anzeige Aufzeichnungen