title: How to use two variables in a foreach loop?
body: <p>I am using dotConnect linq to sqlite. What i want to do is use two variable in a foreach loop. Followed <a href="https://stackoverflow.com/questions/1955766/iterate-two-lists-or-arrays-with-one-foreach-statment-in-c-sharp">this</a> code but it is not working. This is my code snippet.</p>
  
  <pre><code>    bool check_units(int id)
      {
          MainDataContext medic = new MainDataContext();
          bool check = false;
          var medic_query = from m in medic.Medicines
                            orderby m.Id
                            where m.Id == id
                            select m;
  
          var invo_query = from inv in medic.Invoices
                           orderby inv.Id
                           where inv.Id == id
                           select inv;
  
          var med_inv = medic_query.Zip(invo_query, (m, i) =&gt; new { Medicine = m, Invoice = i });
  
          foreach(var mi in med_inv)
          {
              if (mi.Medicine.UNIT &gt; mi.Invoice.UNIT)
              {
                  mi.Medicine.UNIT -= mi.Invoice.UNIT;
                  if (mi.Medicine.UNIT &lt; 10)
                  {
                      MessageBox.Show(mi.Medicine.Name + " is short in Invertory!\nUnits Remaining: " + mi.Medicine.UNIT,
                          "Inventory Empty", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                  }
                  chk = true;
              }
              else
              {
                  MessageBox.Show("Not Enough Stock!\nUnits Remaining: " + mi.Medicine.UNIT,
                      "Inventory Short", MessageBoxButtons.OK, MessageBoxIcon.Error);
              }
          }
          medic.SubmitChanges();
          return chk;
      }
  </code></pre>
  
  <p>The Problem that i am facing is my code gives an error</p>
  
  <blockquote>
    <p>The query operator 'Zip' is not supported.</p>
  </blockquote>
  
  <p>There is no kind of syntax error or warning.
  I think that Zip operator can not be used with linqtosql type of queries!</p>
  
  <p>Waiting for support!
  Thanks :)</p>