Наборы данных Соединение столбцов из двух разных таблиц и использование индексов - PullRequest
0 голосов
/ 08 мая 2018
Ok so I have a stored proc that returns two table dataset [0] + dataset [1]

Can anybody help in figuring how I can loop through the second set of results and join certain columns to the first table?

Basically what I have is targets and actuals e.g.

           A      B     C    D
    hr1    10      22   23    23
    hr2    20     233  222   232
    hr3    22    2334  333  3344

And the table [1] is exactly the same but with the actual targets...

What I am trying to do it add the actuals next to the targets

So for instance A B C D will have the actuals next to the targets...

Hope this is clear... I have also been told to create indexs...

Code so far -- Default aspx - main entry for the web page



     public void Refreshdata(int selectedProduct)
            {
                BizManager biz = new BizManager();


                GridView1.DataSource = biz.GetPacktstatisticsForShift( new 
      DateTime(2016, 4, 1, 6, 0, 0)
                    ,  new DateTime(2016, 4, 16, 13, 59, 59)
                    , selectedProduct).Tables[0].DefaultView;
                GridView1.DataBind();
            }

       Datamanager class -  datamanger class code

       public DataSet TargetQuantites(int itemSeriesMasterId, DateTime 
      shiftstart, DateTime shiftend)
            {
                object[] args = new object[3] { itemSeriesMasterId, shiftstart, 
      shiftend};
                return CallSp(MethodBase.GetCurrentMethod(), args) as DataSet;
            }
        }


    bizmanager class - code class

    public DataSet GetPacktstatisticsForShift(DateTime shiftStart, DateTime shiftEnd, int seriesMasterId)
{
    using (DataManager dmgr = new DataManager())
    {
        dmgr.Connect(ConfigurationManager.AppSettings["ProductionKey"]);
        DataSet dset = dmgr.TargetQuantites(seriesMasterId, shiftStart, shiftEnd);
        dmgr.Disconnect();
        return CreatePackingStats(dset);
    }
}

private DataSet CreatePackingStats(DataSet dset)
{
    using (DataManager dmgr = new DataManager())
    {
        foreach (DataTable table in dset.Tables)
        {
            foreach (var VARIABLE in table)
            {

            }

я полагаю, что мои данные должны пройти цикл в этом последнем утверждении, чтобы получить две таблицы данных и объединить их ??

Моя проблема в том, что я новичок во всем этом, и я кратко понимаю о наборах данных, но у меня нет ни малейшего понятия, чтобы присоединиться к ним ...

Меня тоже просят написать более подробную информацию в моем редакторе, поэтому я не знаю, что еще я могу написать здесь:)

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...