同上! Thanks

解决方案 »

  1.   

    FieldPtr pField=m_pRs->GetFields()->GetItem(colname);
    然后调用fieldptr里的
    getname(),getsize(),等等就可以得到你要的东西
      

  2.   

    Fields *fields;
    long *count
    m_recordset->get_Fields(&fields);
    fields->get_Count(count);
    for(int i=0;i<count;i++){
      BSTR colname;
      fields->Item[i]->get_Name(&colname);
    ...
    }
    colname中为字段名了,请注意程序中的大小写
      

  3.   

    CDaoDatabase db;
    CDaoRecordset rs;//先打开数据库,db.open,和rs.open
    CDaoTableDefInfo    m_info;
    db.GetTableDefInfo(m,m_info);//m_info里就是数据库中表的信息
    int i=db.GetTableDefCount();//表的 数量CDaoFieldInfo   fieldinfo;
    db.GetTableDefInfo(m,m_info);//第m字段的信息
      

  4.   

    错了 ,后面一条是:
     rs.GetFieldInfo(n,fieldinfo);//取第n个字段的信息
    具体的m_info  ,fieldinfo里的信息去msdn上看看吧,里面什么信息都有!!
      

  5.   

    _variant_t filed[12];
    _bstr_t filedname[12];
    bool befirstrow=true;
    while (!m_pUserSet->adoEOF )
    {
    long kk=m_pUserSet->GetFields ()->GetCount ();
    for (long uu=0;uu<kk;uu++)
    {
    filedname[uu]=m_pUserSet->GetFields ()->GetItem ((_variant_t)uu)->GetName ();
    filed[uu]=m_pUserSet->GetCollect (filedname[uu]);   
    printf("%s\t ",(LPCSTR)(_bstr_t)(filed[uu]));
    }   
    printf("\r\n");
    m_pUserSet->MoveNext ();
    }