title: Fill Datatable with list member, if it matches a SQL select
body: <p>I have a list of numbers and names. I would like to search through a database and find if the number matches my sql select. if it does I need to fill it to the datatable along with the name. Then foreach row in the datatable write that to another list. I'm having trouble filling the name to the datatable as well because I'm not using it in the SQl select as a parameter.</p>
  
  <pre><code>DataTable dt = new DataTable();
  
  try {
      using (SqlConnection conn = getconnection()) {
          conn.Open();
          SqlCommand cmd = conn.CreateCommand();
          cmd.CommandTimeout = 5000;
          string select = @"SELECT NBR
                      FROM People
                      where ID in (15,17) and NBR=Nbr and ACCEPTED=0";
  
          foreach (Fields f in Members) {
              cmd.Parameters.Clear();
              cmd.Parameters.AddWithValue("@Nbr", f.nbr);
              cmd.CommandText = select;
              SqlDataAdapter adapt = new SqlDataAdapter(cmd);
              //if f.nbr matches sql select fill it to datatable how can I fill dt with f.name as well?
              adapt.Fill(dt);
          }
      }
  
      foreach (DataRow row in dt.Rows) {
          Fields f1 = new Fields();
          f1.nbr= Convert.ToInt64(row["NBR"]); 
          // f1.name=Convert.ToString(row["Name"]????
          Not.Add(f1);
      }
  </code></pre>