我需要一些帮助来从数据集中获取数据。代码:
DataRelation relation = null;
DataColumn table1Column = null;
DataColumn table2Column = null;
DataColumn table2Column1 = null;
DataColumn table3Column = null;
table1Column = tlobergeDataSet.Tb_Product.Columns[0];
table2Column = tlobergeDataSet.Tb_Transactions.Columns[2];
table2Column1 = tlobergeDataSet.Tb_Transactions.Columns[1];
table3Column = tlobergeDataSet.Tb_Consumer.Columns[0];
relation = new DataRelation("relation", table1Column, table2Column);
tlobergeDataSet.Relations.Add(relation);
relation = new DataRelation("relation1", table3Column, table2Column1);
tlobergeDataSet.Relations.Add(relation);
给定一个产品名称,我需要用每个不同的城市以及该产品在该城市的售价填充一个表格(将该产品的所有价格添加到给定城市的任何消费者)
前表:
产品表:
Prod_ID Name
1 tv
2 couch
消费者表:
Con_Id Name City
----------------------
1 Gray New York
2 Joe Chicago
3 Steve Madison
交易表
Tran_Id Con_ID Prod_ID Price
-------------------------------------
1 2 1 900
2 1 2 300
3 1 1 900
所需表
City Total Sales
----------------------
New York 1200
Chicago 900
Madison 0