vb6.0只能认ACCESS97,不能认ACCESS2000

解决方案 »

  1.   

    楼上的说法不对,vb6.0当然能认ACCESS2000。之所以出现不可识别的数据库的错误,可能是因为引用的ADO或DAO的版本太低。另外,在默认情况下,Data控件也是不能识别ACCESS2000的,解决方法如下:
    Intrinsic Data Control Is Usable with Access 2000 DatabasesAt design time, trying to bind the Data control to a Microsoft Access 2000 database will result in an error: "Unrecognized database format." The Data control can still be used, however, by following the example below: 1、On the Project menu, click References. Clear the Microsoft DAO 3.51 Object Library check box.
    2、Set a reference to the Microsoft DAO 3.6 Object Library. 
    3、Draw a Data control and a TextBox control on a form.
    4、On the Properties window, set the TextBox control's DataSource property to the Data control. 
    5、Type the name of the field CompanyName into the DataField property box.
    6、Insert code similar to the following into the code window: Option Explicit
    Private daoDB36 As Database
    Private rs As Recordset
    Dim sPath As StringPrivate Sub Form_Load()
        sPath = _
        "C:\Program Files\Microsoft Office\Office\Samples\Northwind.mdb"
        Set daoDB36 = DBEngine.OpenDatabase(sPath)
        Set rs = daoDB36.OpenRecordset("Customers")
        Set Data1.Recordset = rs
    End Sub7、Run the project.