我使用此代码生成数据并将其输出到我的 gridview
string sql = "Sql Query";
string sqlCredit= "Sql Query";
string sqlCreditPayment = "Sql Query";
SqlDataAdapter da = new SqlDataAdapter();
DataSet ds = new DataSet();
ds.EnforceConstraints = false;
ds.DataSetName = "Receivables";
ds.Tables.Add((con.ShowResult(sql, ref da)).Tables[0].Copy());
ds.Tables[0].TableName = "dtReceivables";
ds.Tables.Add((con.ShowResult(sqlCredit, ref da)).Tables[0].Copy());
ds.Tables[1].TableName = "dtCredit";
ds.Tables[1].Columns[1].ColumnMapping = MappingType.Hidden;
ds.Tables[1].Columns[7].ColumnMapping = MappingType.Hidden;
ds.Tables.Add((con.ShowResult(sqlCreditPayment, ref da)).Tables[0].Copy());
ds.Tables[2].TableName = "dtCreditPayment";
ds.Tables[2].Columns[0].ColumnMapping = MappingType.Hidden;
DataRelation dr0 = new DataRelation("CreditList", ds.Tables[0].Columns["Id"], ds.Tables[1].Columns["DocSupplierId"]);
ds.Relations.Add(dr0);
DataRelation dr1 = new DataRelation("CreditPaymentList", ds.Tables[1].Columns["Id"], ds.Tables[2].Columns["SourceId"]);
ds.Relations.Add(dr1);
slipDashBoard.DataSource = ds.Tables["dtReceivables"];
slipDashBoard.ForceInitialize();
gridView1.BestFitColumns();
伙计们。请帮忙。当我点击gridview的孩子时,我想实现这样的目标。提前谢谢