Data的DatabaseName和RecordSource都已经设置好
然后在用控件访问的基础上,用SQL做一些Update的操作
当然最好就不要在用opendatabase来再做一个,而直接像这样
Set db = Data1.Database
问题就是这里返回的都是Nothing

解决方案 »

  1.   

    是不是应该这样
    set db=data1.database(某些属性)
      

  2.   

    Data1.DatabaseName = "D:\ProgramsExample\DelphiExample\SCM\project\orientscm97.mdb"
        Data1.Refresh
        Set db = Data1.Database
        Data1.Database.OpenRecordset "SELECT * FROM ASTUFF"
        Data1.Refresh没问题啊~~
      

  3.   

    MSDN的例子:Sub OldDatabaseCode()   Dim wrkMain As Workspace
       Dim dbsPubs As Database
       Dim prpLoop As Property   ' Create Microsoft Jet Workspace object.
       Set wrkMain = CreateWorkspace("", "admin", "", dbUseJet)/b   ' Open a Database object based on information in
       ' the connect string.
       Set dbsPubs = wrkMain.OpenDatabase("Publishers", _
          dbDriverNoPrompt, False, _
          "ODBC;DATABASE=pubs;UID=sa;PWD=;DSN=Publishers")   ' Enumerate the Properties collection of the Database 
       ' object.
       With dbsPubs
          Debug.Print "Database properties for " & _
             .Name & ":"      On Error Resume Next
          For Each prpLoop In .Properties
             If prpLoop.Name = "Connection" Then
                ' Property actually returns a Connection object.
                Debug.Print "  Connection[.Name] = " & _
                   .Connection.Name
             Else
                Debug.Print "  " & prpLoop.Name & " = " & _
                   prpLoop
             End If
          Next prpLoop
          On Error GoTo 0   End With   dbsPubs.Close
       wrkMain.CloseEnd Sub
      

  4.   

    一个小的地方啊
    Data的DatabaseName和RecordSource都设置好之后,应该先做一次refresh
    之后才能读Database,射天狼,谢谢了