title: Select rows where column equals one of the string values in array
body: <p>I'm trying to get relevant rows into datatable, i want only rows that have column value equal to one of the values in other sql table, that's my code:</p>
  
  <pre><code>try
  {
       sc.Open();
       for (int i = 0; i &lt; queryTokens.Length; i++)
       {
            cmd = new SqlCommand("INSERT INTO QueryIndex (Term) Values ('" + queryTokens[i] + "')", sc);
            cmd.ExecuteNonQuery();
       }
       cmd = new SqlCommand("SELECT * FROM TermsIndex Where Term EXIST (Select Term From QueryIndex)");
       SqlDataAdapter da = neuw SqlDataAdapter(cmd);
       da.Fill(tempTable);
       da.Dispose();
       sc.Close();
  }
  catch (Exception e)
  {
       Console.WriteLine(e.ToString());
  }
  </code></pre>
  
  <p>the first part of the insert going well i'm sure, but in the second part, i hope you all understand what i'm trying to do, i know i have syntax errors here so please correct me, and i'm getting this exception message: {"Value cannot be null.\r\nParameter name: dataTable"} Null exception.. </p>
  
  <p>this is my sql create table:</p>
  
  <pre><code>CREATE TABLE [dbo].[TermsIndex]
  (
      [ID] VARCHAR(35) NOT NULL,
      [Term] VARCHAR(35)  NOT NULL,
      [Frequency] int NOT NULL,
      [Offset] VARCHAR(MAX) NOT NULL,
  )
  
  
  CREATE TABLE [dbo].[QueryIndex]
  (
      [Term] VARCHAR(MAX) NOT NULL,
  )
  </code></pre>
  
  <p>so why i'm getting that null error?
  and anyway i'm creating a table just to be able to compare it's entries with column from the first one, i already had it string array, any chance to be able to compare that column value to changing number of strings (tokens) and return row results if it were equal to one of those strings in sql command? or any more elegance way to get the wanted result?</p>