Question

I am coming from more of a .NET background and need to make some changes to a very old VB6 application.

The .NET equivalent of what I'm trying to do now in VB6 is, define a (model) class with 3 properties

public class MyClass
{
  public string Ref { get; set; }
  public string OldNumber { get; set; }
  public string NewNumber { get; set; }
}

In .NET I would then call a stored procedure to return a set of results (there could be a few thousand records) and assign them to, for example, an instance of List<MyClass>.

I could then, whenever I need to, attempt to find an item within this List, where the 'Ref' property is 'blah', and use this item/its other properties (OldNumber and NewNumber).

However, in VB6, I don't know how this same process is best achieved. Can anyone please help?

Was it helpful?

Solution

If you are using ADO you can cache results by querying into a static cursor client-side Recordset and then disconnecting it.

You can use Sort, Find, Filter, etc. and move through the rows as needed. You can even improve searches by building a local index within the Recordset after opening and disconnecting it by using the Field object's Optimize dynamic property. See:

Optimize Property-Dynamic (ADO)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top