CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 1999
    Posts
    14

    Need technique for storing Access table w/data into memory.

    Anyone come up with any good methods for reading entire data tables into memory? I'm developing in C++ and I connect to an Access database through DAO. I've got some really complicated queries that end up going to the database repeatedly and I would like to speed that whole process up by just reading the entire table into memory up front and working off of it from there.

    Thanks in advance for any suggestions.


  2. #2
    Join Date
    Jun 1999
    Location
    Lumberton, NJ
    Posts
    70

    Re: Need technique for storing Access table w/data into memory.

    This isn't really difficult. The most straightforward way of doing this is to create a struct which represents one record. Dynamically allocate an array of these structs for the number of records contained in the table. Then loop, reading rows, and copying them into your array. When you need the data, the use the array instead of the RecordSet (or whatever you're using).

    Hope this helps.



  3. #3
    Join Date
    Sep 1999
    Posts
    14

    Re: Need technique for storing Access table w/data into memory.

    Thanks for the reply. I had actually started doing the array thing anyway. It just seems like there may have been some MFC method within DAO to accomplish this and yet maintain some of the search capabilities of the recordset. Looping through an array works for me though...




  4. #4
    Join Date
    Sep 1999
    Location
    Ontario, Canada
    Posts
    12

    Re: Need technique for storing Access table w/data into memory.

    Consider reading the "Collections Topics" in MSDN and choose a collection that would support database-style navigation and searching. I think that an array is too inefficient, but I may be taking that term <array> too literally.

    Collection Shape Features consists of Shape, Ordered, Indexed, Insert an element, Search for specified element, Duplicate elements considerations.

    I have done VERY complex SQL searches against 30,000+ record, multi-table ACCESS databases using DAO and have had no problems, so I'm not sure what the real problem you're trying to solve is.

    HTH


    Robert

  5. #5
    Guest

    Re: Need technique for storing Access table w/data into memory.

    Can't you use ADO rather than DAO - that way you can use disconnected recordsets that allow for normal DB style calls. Also ADO passed across boundaries will MBV.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured