title: Getting a selection of rows into C# from SQL CE
body: <p>I am relatively new to C# and am developing an application that communicates with a local database (SQL Compact 3.5). I am fine with running standard select statements - but when it comes to getting that data into C# - I get a bit lost.</p>
  
  <p>What I have so far is a 'delete' query that deletes all rows named 'Master'.
  Now I have worked out that I actually need to get the IDs of those rows before I delete them (for database integrity purposes). I have no problems running a standard select query - my problem is <strong>getting a selection of rows from SQL CE into a C# application (using arrays or datatables or whatever is most logical/convenient)</strong>.</p>
  
  <p>This is what I have at the moment, but it only returns one value, not a selection:</p>
  
  <pre><code>string sql = "select listid from list where ShortDesc='Master'";
  SqlCeCommand cmdGetOldMasterId = new SqlCeCommand(sql, DbConnection.ceConnection);
  int oldKey = (int)cmdGetOldMasterId.ExecuteScalar();
  Console.WriteLine("Old ID: " + oldKey);
  </code></pre>
  
  <p>I need to be able to do perform a foreach{ } loop on each of the returned rows. Any ideas how I can do this in C#?</p>