同题

解决方案 »

  1.   

    1.
    _RecordsetPtr   record;
       
      record = lpConnection->OpenSchema(adSchemaTables);
      while(!record->EOF)
      {
          _bstr_t    tableName = record->Fields->GetItem()->Value;
          record->MoveNext();
      }
    2.use sql 
    select name   from sysobjects where uid = (select uid from sysusers where name='username')
      

  2.   

    select [name] from sysobjects where xtype='u'
      

  3.   

    pRstSchema = m_pConnection->OpenSchema(adSchemaTables);//指向所有的表while(!(pRstSchema->adoEOF))   
    {
    _bstr_t table_name = pRstSchema->Fields->GetItem("TABLE_NAME")->Value;//得到表的名称
    pRstSchema->MoveNext();
    }
      

  4.   

    如果怕麻烦可以用 
    sqlserver:
       exec sp_tables 马上列出所有表,呵呵
      

  5.   

    SELECT TABLE_NAME FROM USER_TABLES
      

  6.   

    呵呵,多谢楼上各位,借问一下,为什么m_pConnection->GetState()函数返回的始终都是0啊,我的数据库明显已经打开了啊,都能取得表名。