CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Array search

  1. #1
    Join Date
    Mar 1999
    Location
    USA
    Posts
    25

    Array search

    Two Questions:

    1.
    I am returning a recordset of information that I want to store in a variant array. The RecordCount property, for the recordset, tells me I have RecordCount of 17. When I go to make the variant array equal to what is being stored in the recordset,the UBound of the variant array is now only showing a count of 13. Is there a specific reason as to why I am loosing information from the transfer??

    2.
    I have a large recordset of information (RecordCount = 53000); this will be stored in a variant array. I need to be able to loop through the array, and compare a separate specific piece of information (ie. Client ID) with that stored in the array. Would the best way to do this be by performing a Binary Search?? If not does anyone have any other suggestions??

    Thanks,
    Sam


  2. #2
    Join Date
    Jul 1999
    Location
    Athens, Hellas
    Posts
    769

    Re: Array search

    As far as I know the property RecordCount doesn't work well. Please tell me which ADO do you use, 2.0, 2.1, 2.5 ???
    The other thing that I'd like to ask is why do you have to pass all the values to an array in order to search for? I think you could do your search inside recordset with the methods that ADO provides...

    Michael Vlastos
    Automation Engineer
    Company SouthGate Hellas SA
    Development Department
    Athens, Greece

  3. #3
    Join Date
    Apr 1999
    Location
    Netherlands
    Posts
    181

    Re: Array search

    I agree with that. To be sure the recordcount works fine you need to do a MoveLast and then a MoveFirst again.
    Indeed, why do you want to put it in array before you search? If you are looking for a specific set of records (with a certain ID or something) you can open the recordset with a query like
    "SELECT * FROM mytable WHERE ID = " & lID
    That way you only get the records you want.

    Crazy D @ Work :-)

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