用以下代码可以实现:
//TableName是要查询的表名。通过检索数据库中的表名来确定TableName是否存在。
//也就是列举数据库的表。
try
{
 _RecordsetPtr  pRstSchema  = NULL;
 pRstSchema = m_pConnection->OpenSchema(adSchemaTables);
 while(!(pRstSchema->AdoEOF))
 {
  if(TableName == (_bstr_t)pRstSchema->Fields->GetItem("TABLE_NAME")->Value)
  {
     pRstSchema->Close();
     return TRUE;
  }
  pRstSchema->MoveNext();
 }
 return FALSE;
}
catch (_com_error &e)
{
   AfxMessageBox("获取表名出错!");
   return FALSE;
}