I have a c# question :
I have 2 datatable A and B both of them contain a column called “move” , I want to create another Datable with 2 columns one with “move” from A the other with “move” from B , I tried something like this :
//cherche les last price
DataTable TickerPrice = new DataTable("Data");
TickerPrice = CheckBloomi(TickerName + " equity", "CHG_PCT_1D", FromThisTime, ToThisTime);
//cherche les last price
DataTable IndexPrice = new DataTable("Data");
IndexPrice = CheckBloomi("E300 Index", "CHG_PCT_1D", FromThisTime, ToThisTime);
DataSet MarketData = new DataSet();
DataTable Recap = MarketData.Tables.Add("Recap");
Recap.Columns.Add("Move Ticker price");
Recap.Columns.Add("Move Index price");
foreach (DataRow sourcerow in TickerPrice.Rows)
{
DataRow destRow = Recap.NewRow();
destRow["Move Ticker price"] = sourcerow["CHG_PCT_1D"];
Recap.Rows.Add(destRow);
}
foreach (DataRow sourcerow in IndexPrice.Rows)
{
DataRow destRow = Recap.NewRow();
destRow["Move Index price"] = sourcerow["CHG_PCT_1D"];
Recap.Rows.Add(destRow);
}
This work fine to copy one column (for the first foreach loop) but then for the second column I have the number shifted because I am recreating new rows.
Do you an idea of how to do that ?, let me know if it is not clear enough
Assuming that the both the TicketPrice and IndexPrice tables match up then you could do something like: