Hello Bilal,
Thanks for the reply. I checked my CVI code and am doing all the things you said. But when I run the code I see a big leap in the memory usage after 1000 iterations or so. I monitored the private bytes using Windows Performance monitor.
Here is the sample code.
CVI Version 7.0
OS: Windows 2000
Database: MS Access 2000
ADO Version: 2.53.6200.0
CAObjHandle connectionHandle = S_OK; 
CAObjHandle rsHandle = S_OK;
LPDISPATCH lpDispatch;
VARIANT dbConnection; 
VARIANT source;
// Create connection object
ADODB_New_Connection (NULL, 1, LOCALE_NEUTRAL, 0, &connectionHandle);
// Open Connection
ADODB__ConnectionOpen (connectionHandle, NULL, "DSN=MyDatabase;UID="";PWD="";", "", "", -1);
// Get active connection into variant
CA_GetInterfa
ceFromObjHandle (connectionHandle, 0, 0, &lpDispatch, NULL);
dbConnection = CA_VariantDispatch (lpDispatch);
for ( i = 0; i < 3000; i++) {
  // Create record set object
  ADODB_New_Recordset (NULL, 1, LOCALE_NEUTRAL, 0, &rsHandle); 
  // Set SQL string
  CA_VariantSetCString (&source, "SELECT * FROM mytable")); 
  // Open recordset
  ADODB__RecordsetOpen (rsHandle, &err, source, dbConnection, ADODBConst_adOpenStatic,ADODBConst_adLockReadOnly, -1));
  // close recordset
  ADODB__RecordsetClose (rsHandle, NULL);
  // Clear SQL variant
  CA_VariantClear(&source);
  // Discard recordset object
  CA_DiscardObjHandle(rsHandle); 
}
// Clear connection variant
CA_VariantClear(&dbConnection);
// Close connection
ADODB__ConnectionClose(connectionHandle, NULL);
// Discard connection object
CA_DiscardObjHandle(connectionHandle);
Thanks in advance for your help.
Mano