title: An error occurred while executing the command definition. See the inner exception for details ( linq)
body: <p>Since I am new to entity framework and linq, I don't know much about entity framework or linq. Currently I am facing exception <code>An error occurred while executing the command definition. See the inner exception for details.</code> on: </p>
  
  <pre><code>foreach (var items in query)
              {
                  var outtime= from x in con.CHECKINOUTs
                               select x;
              }
  </code></pre>
  
  <p>But it works perfectly if I do query outside foreach loop.</p>
  
  <pre><code>var outtime= from x in con.CHECKINOUTs
                     select x;
  </code></pre>
  
  <p>What I need to do is for each items of query, i need to add another field based on outtime.</p>
  
  <p>Please suggest me what to do? and how to get more detail information about exception <code>An error occurred while executing the command definition. See the inner exception for details.</code></p>