다른 위치에 다른 연결을 가진 2 개의 MS Access 데이터베이스가 있습니다. 첫 번째 데이터베이스의 테이블에서 레코드를 삭제하는 것은 작동하지만 두 번째 데이터베이스의 테이블에서 복사 된 새 레코드를 삽입하는 것은 작동하지 않습니다. 첫 번째 데이터베이스의 테이블은 비어 있습니다. 두 번째 데이터베이스의 테이블에 새 레코드가 삽입 된 이유는 두 번째 데이터베이스가 복사되어 자신에게 삽입 된 레코드가 많기 때문입니다. 내가 원하는 것은 두 번째 데이터베이스의 복사 된 레코드가 첫 번째 데이터베이스에 붙여 넣기/삽입된다는 것입니다.한 테이블의 레코드를 다른 연결 문자열을 가진 다른 데이터베이스 테이블로 복사하는 방법은 무엇입니까?
SQLStr1는 첫 번째 데이터베이스 SQLStr2의 위치 문자열은
Dim conn As OleDbConnection
Dim conn2 As OleDbConnection
Dim cmd As OleDbCommand
Dim cmd2 As OleDbCommand
Dim SQLStr1 As String
Dim SQLStr2 As String
conn = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=psipop.accdb;Jet OLEDB:Database Password=cscfo13poppsi;")
'I used 'psipop' because the database is located the same with the application.
SQLStr1 = "DELETE * FROM pop 'psipop'"
conn.Open()
cmd = New OleDbCommand(SQLStr1, conn)
cmd.ExecuteNonQuery()
'I used " & TextBox3.Text & " because the textbox3 contains the path of the another database.
conn2 = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source= '" & TextBox3.Text & "' ;Jet OLEDB:Database Password=cscfo13poppsi; ")
SQLStr2 = "INSERT INTO pop SELECT * FROM pop IN '" & TextBox3.Text & "'"
conn2.Open()
cmd2 = New OleDbCommand(SQLStr2, conn2)
cmd2.ExecuteNonQuery()
이 저를 도와주세요 번째 databas의 위치 문자열입니다. 고맙습니다.