- Jan 15, 2001
- 15,069
- 94
- 91
I found this and then used it in a WPF/C# project and it worked very well. I thought I'd pass it along in case anyone else is interested.
Link
From the link, here's a quick example of how you use it:
You can give it a list of fields to search and a search string, which it will then do exactly what you think it does: search every field for the string (contains). It can get a more complex to handle varying data types like so:
Link
From the link, here's a quick example of how you use it:
Code:
string[] columns_to_search = {"first_name", "last_name", "email_address", "category.category_name"};
string[] search_terms = {"stan"};
var search_results = new dbDataContext()._users.Search(columns_to_search, search_terms);
You can give it a list of fields to search and a search string, which it will then do exactly what you think it does: search every field for the string (contains). It can get a more complex to handle varying data types like so:
Code:
foreach (string s in search_string.Split(search_delimiters))
{
if (Int32.TryParse(s, out obInt)) obs.Add(obInt);
else if (DateTime.TryParse(s, out obDt)) obs.Add(obDt);
else if (bool.TryParse(s, out obBool)) obs.Add(obBool);
else obs.Add(s); // else it's a string
}