title: Why can't I get the first element of a populated IQueryable?
body: <pre><code>    protected Server getServerByName(string name)
      {
          var servers = from qServer in db.Servers
                        where qServer.Name == name
                        select qServer;
  
          if (servers.Count() &gt; 0)
          {
              return servers.First(); // The error occurs on this line
          }
  
          return null;
      }
  </code></pre>
  
  <p>This code has been working as expected up until now, however today it suddenly started giving this error:</p>
  
  <blockquote>
    <p>An exception of type
    'System.Data.Entity.Core.EntityCommandExecutionException' occurred in
    mscorlib.dll but was not handled in user code Additional information:
    An error occurred while executing the command definition. See the
    inner exception for details.</p>
  </blockquote>
  
  <p>I can't understand the error, even less than I can understand how this can happen. Does anyone have any idea why this is happening?</p>