private void ApplyKeywordFilter() { if (!string.IsNullOrEmpty(comboBoxFilter.Text)) { string[] words = comboBoxFilter.Text.Split(' '); StringBuilder criteria = new StringBuilder(); int counter = 0; foreach (string word in words) { counter++; if (counter > 1) { criteria.Append(" OR "); } criteria.Append(" (lyrname LIKE '%" + word + "%' OR lyrdescription LIKE '%" + word + "%') "); Cursor.Current = Cursors.WaitCursor; DataTable table = new DataTable(); List <string> paths = new List <string>(); LayerfileIndexBuilder builder = new LayerfileIndexBuilder(); string indexPath = builder.GetDefaultIndexFilePath(); if (System.IO.File.Exists(indexPath)) { string connectionString = "Data Source=" + indexPath + ";Version=3;"; using (SQLiteConnection connection = new SQLiteConnection(connectionString)) { connection.Open(); string sql = "SELECT lyrname, lyrdescription,lyrfilename,lyrfullpath,lyrrevision,lyrgid,daterecmodified FROM layerfile " + "WHERE " + criteria.ToString(); System.Diagnostics.Debug.WriteLine(sql); using (SQLiteCommand command = new SQLiteCommand(sql, connection)) { using (SQLiteDataAdapter adapter = new SQLiteDataAdapter(command)) { adapter.Fill(table); dataGridView.DataSource = table; } } connection.Close(); } } Cursor.Current = Cursors.Default; } } }