Object as database
-
Hi to all! A short question: Is it possible, to use an object,list,array or something like that as a database? So I want to run SQL like queries on my object. Ex. I have a list, witch contains Person object (List Persons) Person class for ex.:
class Person { private int _id; public int ID { get{return _id} } private string _name; public string Name { get{return _name} } }
I want to run a select for those persons who have id under 10 like this: SELECT * FROM Persons WHERE ID<10 How can I do this? I try it witd bindingsource, try to add my class as project datasource, but nothing work :( Thanks for help. -
Hi to all! A short question: Is it possible, to use an object,list,array or something like that as a database? So I want to run SQL like queries on my object. Ex. I have a list, witch contains Person object (List Persons) Person class for ex.:
class Person { private int _id; public int ID { get{return _id} } private string _name; public string Name { get{return _name} } }
I want to run a select for those persons who have id under 10 like this: SELECT * FROM Persons WHERE ID<10 How can I do this? I try it witd bindingsource, try to add my class as project datasource, but nothing work :( Thanks for help.You can write a function object to return the items you want and then use the Find method, passing in the predicate. http://windowssdk.msdn.microsoft.com/en-us/library/x0b5b5bc(VS.80).aspx[^]
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog
-
You can write a function object to return the items you want and then use the Find method, passing in the predicate. http://windowssdk.msdn.microsoft.com/en-us/library/x0b5b5bc(VS.80).aspx[^]
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog
Thank's for quick replay. I do this way, some times ago, but now, I wont write all the search, and filter method by hand. Becouse of the complex querys, witch generated at runtime, as the user wants. Ex.: somethimes I ned a quer like this: select * from partners where id<10 and name like'Mr.%' ..... and somethimes need group by option too.