我有一张如下表>
Party_Code | Buy_Sell | Trade_Qty | Market_Rate
036L09 1 350 20
036L09 2 300 30
我试图在该数据中显示一个网格,如下所示>
BuyQty | BuyRate | BuyAmt|SellQty | SellRate | SellAmt
350 20 7000 300 30 9000
为此我做了两个查询>>
select sum(Trade_qty) as BuyQty, sum(Market_Rate) as BuyAmt from tradeFile where Buy_Sell='1' and Party_Code='036L09'
select sum(Trade_qty) as SellQty, sum(Market_Rate) as SellAmt from tradeFile where Buy_Sell='2' and Party_Code='036L09'
我希望这些查询适用于单个网格。为此,我将代码编写为>>
try
{
da = new SqlDataAdapter("select sum(Trade_qty) as BuyQty, sum(Market_Rate) as BuyAmt from tradeFile where Buy_Sell='1' and Party_Code='0L036'", con);
DataSet ds = new DataSet();
da.Fill(ds);
SqlDataAdapter sellDA = new SqlDataAdapter("select sum(Trade_qty) as SellQty, sum(Market_Rate) as SellAmt from tradeFile where Buy_Sell='2' and Party_Code='0L036'", con);
DataSet dsSell = new DataSet();
sellDA.Fill(dsSell);
gv.DataSource = ds.Tables[0];
gv.DataSource = dsSell.Tables[0];
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
但它只从最后一个数据源获取数据。
我该怎么做?