Free Tables
Here is some sample code to open the Foxuser.DBF table: 
   Private Sub Form_Load()
       Dim FoxFreeDB As Database
       Dim FoxFreeRS As Recordset
       Set FoxFreeDB = Workspaces(0).OpenDatabase("C:\VFP", False, _
                       False, "FoxPro 3.0;")
       Set FoxFreeRS = FoxFreeDB.OpenRecordset("Foxuser")
       Set Data1.Recordset = FoxFreeRS
   End Sub 
Database Tables
Here is some sample code to open the Employee.DBF table that resides in the Tastrade.DBC database container: 
   Private Sub Form_Load()
       Dim FoxDataDB As Database
       Dim FoxDataRS As Recordset
       Set FoxDataDB = Workspaces(0).OpenDatabase( _
                       "C:\VFP\Samples\Mainsamp\Data\Tastrade.DBC", _
                       False, False, "FoxPro DBC;")
       Set FoxDataRS = FoxDataDB.OpenRecordset("Employee")
       Set Data1.Recordset = FoxDataRS
   End Sub When Visual Basic accesses a Visual FoxPro "database table," it uses the .DBC file to list and locate .DBF files. Visual Basic does not use the .DBC file to determine the structure of the .DBF files; that information is obtained by examining the .DBF file itself. This means that long field names, which Visual FoxPro stores in the .DBC file, will not be accessible in Visual Basic. For example, the above sample that reads the Employee table will have an Employee ID field "Employee_I" instead of "Employee_ID" because the .DBF file does not store the long field name. Another ramification of reading the linked tables directly is that Jet s these tables as read-only because all the Referential Integrity rules for a table are stored in the database container file. Visual FoxPro free tables are also read only. NOTE: The 16-bit edition of Visual Basic version 4.0 cannot read files in the Visual FoxPro version 3.0 format without a third-party ODBC driver. 

解决方案 »

  1.   

    to coolstar():在Database Tables说明中,按照你提出的方法,
          Private Sub Form_Load()
          Dim FoxDataDB As Database
          Dim FoxDataRS As Recordset
          Set FoxDataDB = Workspaces(0).OpenDatabase( _
                          "C:\VFP\Samples\Mainsamp\Data\Tastrade.DBC", _
                          False, False, "FoxPro DBC;")
          Set FoxDataRS = FoxDataDB.OpenRecordset("Employee")
          Set Data1.Recordset = FoxDataRS
      End Sub 
      但是对于FoxDataRs进行.AddNew等数据追加,更改时总是提示数据库或对象不能更新。还请也随便帮帮我吧。
      

  2.   

    也请发一份给我:[email protected]
    谢了!