title: ExecuteReader() in Powershell script
body: <p>I'm trying to read data from a SQL table in a powershell script. I can see the data in reader object, but when reading it using <code>While (readerobject.read()){}</code>, it's not going inside the loop.</p>
  
  <p><strong>Powershell</strong>:</p>
  
  <pre class="lang-cs prettyprint-override"><code> $cmd = $sqlConn.CreateCommand()
   $cmd.CommandText ="SELECT * from user"
   $movedUserDetails = $cmd.ExecuteReader()
   while ($movedUserDetails.Read())
     {
        "[0] : " + $movedUserDetails.GetValue(0)
     }
   $movedUserDetails.Close() 
  </code></pre>