G
giddy
hi,
Yes its a design question again. =)
If I have something like:
class Person
{
//functions:
static Person[] GetAllPersons();
static Person[] Search(string field,string value);
}
In the second function I would do something like build an sql query
like this:
eg:
Person[] teens = Person.Search("Age",18);
Firstly the biggest problem searching with AND, >,<, OR, Between etc.?
Which terribly limits the search.I could make more functions for that,
but its turns into a little bit of a mess. Is there a better/more
generic way to build a query on the fly?
Would I benefit by using Linq instead/would it be more efficient to
load all persons in memory and then search them with linq? If I were
to use linq how again would I write a function to build a query on the
fly?
Thanks so much
Gideon
Yes its a design question again. =)
If I have something like:
class Person
{
//functions:
static Person[] GetAllPersons();
static Person[] Search(string field,string value);
}
In the second function I would do something like build an sql query
like this:
and send it through another data class to retrieve the right Persons.SELECT ........... WHERE field = value
eg:
Person[] teens = Person.Search("Age",18);
Firstly the biggest problem searching with AND, >,<, OR, Between etc.?
Which terribly limits the search.I could make more functions for that,
but its turns into a little bit of a mess. Is there a better/more
generic way to build a query on the fly?
Would I benefit by using Linq instead/would it be more efficient to
load all persons in memory and then search them with linq? If I were
to use linq how again would I write a function to build a query on the
fly?
Thanks so much
Gideon