详见 http://community.csdn.net/Expert/TopicView3.asp?id=3783229
帮别人做一个小系统就是从一个dbf文件中提取相关的值,然后计算输出
现在用data控件绑定到datagrid后,出现"外部表不是预期的格式"的错误.
并且用Acess2003打开此文件也是相同的错误,请问如何解决?
这个数据库好像是dbase的某个版本,当时具体不知道是那个,如何判断这个dbf文件是由那种数据库创建的?
ado.connectstring的属性为
 
oConn.Open "Driver={Microsoft dBASE Driver (*.dbf)};" & _
         "DriverID=277;" & _
         "Dbq=c:\somepath;"Note: Specify the filename in the SQL statement. For example:
     oRs.Open "Select * From user.dbf", oConn, , ,adCmdTextNote: MDAC 2.1 (or greater) requires the Borland Database Engine (BDE) to update dBase DBF files. (Q238431).

解决方案 »

  1.   

    who can help me ?????
      

  2.   

    我是这样做的,可以,你试一下
    Dim cn As New ADODB.Connection
      Dim rs As New ADODB.Recordset
      Dim cnstr As String
      cnstr = "Driver={Microsoft Visual FoxPro Driver};" & _
               "SourceType=DBF;" & _
               "SourceDB=" & Str & ";" & _
               "Exclusive=No"
          'MsgBox Str
         'MsgBox cnstr
    cn.Open cnstr
      rs.CursorLocation = adUseClient
      rs.Open "select * from gdzc.DBF", cn, adOpenKeyset, adLockBatchOptimistic
      Set DataGrid1.DataSource = rs
      DataGrid1.Refresh
      

  3.   

    'ADO连接DBF数据库
    Dim conn As New ADODB.Connection
    conn.ConnectionString = "provider=msdasql;DRIVER=Microsoft Visual FoxPro Driver;UID=;Deleted=yes;Null=no;Collate=Machine;BackgroundFetch=no;Exclusive=No;SourceType=DBF;SourceDB=C:\fox\data;"
    conn.Open
      

  4.   

    关键问题出在已经能打开数据库了,可是一用select查询就出现"外部表不是预期的格式"的错误
    这个是怎么回事?