title: Select 5 rows from database store each one in an array?
body: <p>I have a database that stores invoice information. Each invoice can have up to 5 jobs relation, each job has a unique id number.  </p>
  
  <p>I've performed a select statement selecting all jobs relevant to a single invoice.</p>
  
  <p>I have tried many ways to read the selected job id and store them in a jobArray. I would prefer to have it selecting using a for loop but most of the ways I've tried use textBoxes (which I replaced with my array) </p>
  
  <p>This is my most recent code;</p>
  
  <pre><code>     SqlCeCommand cmdCountJobs = new SqlCeCommand("SELECT COUNT(Job_ID)AS INVCOUNT FROM Invoice WHERE Invoice_Number = " + maxInvoice + " ", cn);
          cmdCountJobs.Connection = cn;
          reader = cmdCountJobs.ExecuteReader();
          while (reader.Read())
          {
              countValue = Convert.ToInt32(reader["INVCOUNT"].ToString());
          }         
          SqlCeCommand cmdJobSearch = new SqlCeCommand("SELECT Job_ID as ID FROM Invoice WHERE Invoice_Number = " + maxInvoice + " ", cn);
          cmdJobSearch.Connection = cn;
          reader = cmdJobSearch.ExecuteReader(); 
          SqlCeDataAdapter da = new SqlCeDataAdapter(cmdJobSearch);
          jobArray[0] = (reader.Read()) ? reader["ID"].ToString() : "";
          jobArray[1] = (reader.Read()) ? reader["ID"].ToString() : "";
          jobArray[2] = (reader.Read()) ? reader["ID"].ToString() : "";
          jobArray[3] = (reader.Read()) ? reader["ID"].ToString() : "";
          jobArray[4] = (reader.Read()) ? reader["ID"].ToString() : "";   
          }
  </code></pre>
  
  <p>Could you help me with this?  </p>