Thursday 8 July, 2010

ROWFILTER

  1. private string RowFilter(string field, string keywords)
  2. {
  3. string output = String.Empty;
  4. String[] straKeywords = keywords.Split(' ');
  5. int arrayLength = straKeywords.Length - 1;
  6. int i = 0;
  7. foreach (string keyword in straKeywords)
  8. {
  9. output += String.Format("([{0}] LIKE '%{1}%')", field, keyword);
  10. if (i++ < arrayLength)
  11. output += " OR ";
  12. }
  13. return output;
  14. }

No comments:

Post a Comment