Listing D
  // Check state of Recordset
  long nState;
  hr = m_iADOCERS->get_State(&nState);
  ASSERT(SUCCEEDED(hr));
 
  // Close the Recordset
  if(nState == adStateOpen)
  {
    hr = m_iADOCERS->Close();
    ASSERT(SUCCEEDED(hr));
  }