title: Comparing output of program with the sqlite database
body: <p>I am comparing dataVal output with the sqlite database as shown in the code below.
  For Example: Lets assume output of dataVal is Kelly. When I run the program, in the first loop string z stores value &quot;K&quot; and then store &quot;Kelly&quot; only after second loop. Can someone please elaborate what is happening here and how to get the value of z as 'Kelly' after first loop?</p>
  <pre><code>dataVal = string.Join(&quot;&quot;, dataResult.ToArray());
  Aryabase databaseObject = new Aryabase();
  
  if (dataVal.StartsWith('k'))
  {
      using (SQLiteConnection con = new SQLiteConnection(databaseObject.myConnection))
      {
          SQLiteCommand cmd = new SQLiteCommand(&quot;select * from k where Data like 'k%'&quot;, con); 
          con.Open();
          var rdr = cmd.ExecuteReader();
          while (rdr.Read())
          {
              string z = Convert.ToString(rdr[&quot;Data&quot;]);
              if (dataVal == z)
              {
                  Console.WriteLine(Convert.ToString(rdr[&quot;Data&quot;]));
              }
            
          }
      }
  }
  </code></pre>