title: Getting "This method or property cannot be called on Null values" error
body: <p><strong>UPDATE 1:</strong></p>
  
  <p>The exception is being thrown on this line:</p>
  
  <pre><code>client_group_details.Add(new ClientGroupDetails(
  </code></pre>
  
  <p><strong>ORIGINAL QUESTION:</strong></p>
  
  <p>I have the following code which I have stripped down from 30 columns of data from the database to just 2 columns from the database.  I get an error whenever any of the columns return a NULL value:</p>
  
  <pre><code>public class ClientGroupDetails
  {
      public String Col2;
      public String Col3;
  
      public ClientGroupDetails(String m_Col2, String m_Col3)
      {
          Col2 = m_Col2;
          Col3 = m_Col3;
      }
  
      public ClientGroupDetails() { }
  }
  
  [WebMethod()]
  public List&lt;ClientGroupDetails&gt; GetClientGroupDetails(string phrase)
  {
      var client_group_details = new List&lt;ClientGroupDetails&gt;();
  
      using (connection = new SqlConnection(ConfigurationManager.AppSettings["connString"]))
      {
          using (command = new SqlCommand(@"select col2, col3 where col1 = @phrase", connection))
          {
              command.Parameters.Add("@phrase", SqlDbType.VarChar, 255).Value = phrase;
  
              connection.Open();
              using (reader = command.ExecuteReader())
              {
                  int Col2Index = reader.GetOrdinal("col2");
                  int Col3Index = reader.GetOrdinal("col3");
  
                  while (reader.Read())
                  {
                      client_group_details.Add(new ClientGroupDetails(
                          reader.GetString(Col2Index),
                          reader.GetString(Col3Index)));
                  }
              }
          }
      }
  
      return client_group_details;
  }
  </code></pre>
  
  <p>The error I am getting is:</p>
  
  <p>Data is Null. This method or property cannot be called on Null values.</p>
  
  <p>I'm not sure what to do here to deal with NULL values as the code above is a stripped down version. </p>
  
  <p>Anyone know how to solve this issue?</p>