CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 1999
    Posts
    71

    Open Multiple Database File

    How can i open multiple table in the same database file for DAO and ADO method?
    example:
    Filename: database1
    Table: Table1, Table2

    what i want to do is to save the different record into dirfferent table.

    Help please....Thanks a lot



  2. #2
    Join Date
    Feb 2001
    Posts
    54

    Re: Open Multiple Database File

    Hello:

    I open multiple ADO and DAO to open multiple tables. I used to this code to save records from one table to another in ADO.

    Private Sub Command1_Click()
    On Error Resume Next
    Do Until Adodc2.Recordset.EOF
    If Adodc2.Recordset.BOF Then
    Adodc1.Recordset.AddNew
    Adodc1.Recordset.Fields(0).Value = Adodc2.Recordset.Fields(0).Value
    Adodc1.Recordset.Fields(1).Value = Adodc2.Recordset.Fields(1).Value
    Adodc1.Recordset.Fields(2).Value = Adodc2.Recordset.Fields(2).Value
    Adodc2.Recordset.MoveNext
    Else
    Adodc1.Recordset.AddNew
    Adodc1.Recordset.Fields(0).Value = Adodc2.Recordset.Fields(0).Value
    Adodc1.Recordset.Fields(1).Value = Adodc2.Recordset.Fields(1).Value
    Adodc1.Recordset.Fields(2).Value = Adodc2.Recordset.Fields(2).Value
    Adodc2.Recordset.MoveNext
    End If
    Loop
    If Adodc2.Recordset.EOF Then
    Adodc1.Recordset.AddNew
    Adodc1.Recordset.Fields(0).Value = Adodc2.Recordset.Fields(0).Value
    Adodc1.Recordset.Fields(1).Value = Adodc2.Recordset.Fields(1).Value
    Adodc1.Recordset.Fields(2).Value = Adodc2.Recordset.Fields(2).Value
    Adodc2.Recordset.MoveNext
    End If
    End Sub

    Good Luck



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured