dcsimg


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: integrate db

  1. #1
    Join Date
    Apr 2005
    Posts
    27

    integrate db

    hello
    i have two Dbs with same fields

    i read second DB from opendialog(so i have DB name not table name)

    because i read from opendlg so the second db is not open

    how can i save data in sedond DB into first (integerate dB)

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  3. #3
    Join Date
    Apr 2005
    Posts
    27

    he

    hello

    i wanna to get dB name with opendialog so i wrote this code Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    If OpenFileDialog1.ShowDialog = DialogResult.OK Then
    Dim con2 As New OleDbConnection()
    con2.ConnectionString = _
    ("Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "Data Source=" & OpenFileDialog1.FileName)
    con2.Open()
    Dim da As New OleDbDataAdapter("select * from" & con2.Container, con2)
    Dim ds As New DataSet()
    da.Fill(ds, "db2")

    con2.Open()
    Dim dr As DataRow()
    For Each dr In ds.Tables(0).Rows
    DataSet11.Merge(ds, True)
    Next
    OleDbDataAdapter1.Update(DataSet11)
    End If
    End Sub

    this code is incorrect can you help me

  4. #4
    Join Date
    Dec 2003
    Posts
    2,750
    Rather than using Merge wouldn't it be easier to just use a SQL append query since the tables have the same fields?

    Code:
     
            Dim AccessConn As New System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" & _
                                                                "Data Source=e:\My Documents\db1.mdb")
    
            AccessConn.Open()
    
            Dim AccessCommand As New System.Data.OleDb.OleDbCommand("INSERT INTO [MS Access;DATABASE=e:\My Documents\db10.mdb;].[Data] SELECT * FROM [Data]", AccessConn)
    
            AccessCommand.ExecuteNonQuery()
            AccessConn.Close()
    Paul
    ~~~~
    Microsoft MVP (Visual Basic)

Similar Threads

  1. How to Integrate PayPal into website ?
    By bit_ravinder in forum .NET
    Replies: 3
    Last Post: 07-12-2005, 01:26 AM
  2. integrate html in xml file
    By Sana in forum XML
    Replies: 0
    Last Post: 02-05-2001, 05:15 PM
  3. Integrate Custom SP with insert trigger
    By MikeV in forum Database
    Replies: 1
    Last Post: 01-27-2001, 11:09 AM
  4. Replies: 0
    Last Post: 10-21-2000, 03:56 AM
  5. integrate exch. sql 7.0
    By dnash in forum Enterprise
    Replies: 1
    Last Post: 05-17-2000, 06:49 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center