Populate a FlexGrid or Sheridan DataGrid with Data from an ADO Recordset

Category:
Database
Type:
Snippets
Difficulty:
Intermediate
Author:
Eddie Merkel

Version Compatibility: Visual Basic 6, Visual Basic 5

More information:
This is one of two functions on the site that loads dtaa from an ADO recordset into an MSFlexGrid, the other is at http://www.freevbcode.com/ShowCode.Asp?ID=1728. There are a number of differences between the two; unlike the other function, this one works with a Sheridan DataGrid as well, requires VB6, uses ADO's GetString method to speed things up, and takes care of clearing the grid. However, the other function adds field names as well as values whereas this one does not.

Instructions: Copy the declarations and code below and paste directly into your VB project.

Declarations:

Code: