Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Object as database

Object as database

Scheduled Pinned Locked Moved C#
questiondatabasedata-structureshelp
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nemopeti
    wrote on last edited by
    #1

    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.

    C 1 Reply Last reply
    0
    • N nemopeti

      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.

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      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

      N 1 Reply Last reply
      0
      • C Christian Graus

        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

        N Offline
        N Offline
        nemopeti
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups