dbf文件可以用access打开,如果打不开,恐怕不是标准的dbf文件

解决方案 »

  1.   

    在FOXPRO中可以打开啊,关键是不想用ODBC,想用文件路径访问。
      

  2.   

    ODBC也可以指定文件路径访问
    #include "stdafx.h"
    #import "c:\\Program Files\\Common Files\\System\\ado\\msado15.dll" no_namespace rename("EOF", "EndOfFile")
    int main(int argc, char* argv[])
    {
    printf("Use ADO to open c:\\tmp\\images.dbf database file!\n");
       CoInitialize(NULL);
       try
       {
          _ConnectionPtr pConn("ADODB.Connection");
          _RecordsetPtr  pRst("ADODB.Recordset");
    pConn->Open("Driver={Microsoft dBASE Driver (*.dbf)};DBQ=C:\\tmp\\; DriverID=533;"
    ,"","",adConnectUnspecified);
          pRst->Open("images", _variant_t((IDispatch *) pConn, true),
             adOpenStatic, adLockReadOnly, adCmdTable);
      FieldsPtr fds=pRst->GetFields();
      printf("printf field name of all the table\n");
      for(int i=0;i<fds->GetCount();i++)
      {
      FieldPtr fd=fds->GetItem(_variant_t(short(i)));
      printf("%s   ",(LPCTSTR)fd->GetName());
      }
      printf("\n");
          pRst->Close();
          pConn->Close();
       }
       catch (_com_error &e)
       {
          printf("Description = '%s'\n", (char*) e.Description());
       }
    ::CoUninitialize();
    return 0;
    }
      

  3.   

    masterz() :你这样import在vc 中好象不行
    我试过了
    在 "stdafx.h"中
    #import "c:\Program Files\Common Files\System\ado\\msado15.dll" no_namespace rename("EOF", "EndOfFile")
    才行,
      

  4.   

    此文件为标准的dbf 文件,用dbase iv driver 连接是可以的。
      

  5.   

    不过要通过ado 访问shp 文件可是有点奇怪,只看属性有什么用呢?