Information Technologies Cimahi Glossary    Contact Us
Search  
   
Browse by Category
Information Technologies Cimahi .: Source Code Program Aplikasi dengan VB .: Transfer Data antar Database | SQLServer to Access - Access to SQLServer dengan Visual Basic 6.0

Transfer Data antar Database | SQLServer to Access - Access to SQLServer dengan Visual Basic 6.0

'---------------------------------------------------------------------------------------
' Module    : Transfer Antar Database
' Author     : Tatang Sutarman
' Date        : 03/02/2010
' Purpose   :
'---------------------------------------------------------------------------------------
Option Explicit

Dim CN              As ADODB.Connection
Dim SQL            As String
Dim AccessApp   As String

Private Sub KonekDB()
On Error GoTo KonekDB_Error

    AccessApp = Trim(App.Path & "\Data.mdb")
    Set CN = New ADODB.Connection
    CN.Open "PROVIDER=MSDASQL;" & _
            "DRIVER={Microsoft Access Driver (*.mdb)};" & _
            "DBQ= " & AccessApp & ";" & _
            "UID=sa;PWD=;"

   On Error GoTo 0
   Exit Sub

KonekDB_Error:

    MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure KonekDB of Form Form1"
End Sub

Private Sub ADOSQL2ACCESS()
On Error GoTo ADOSQL2ACCESS_Error

    KonekDB
    
    SQL = "SELECT * INTO " & _
          "AccessTbl " & _
          "FROM " & _
          "[ODBC;Driver=SQL Server; " & _
          "SERVER=(local);DATABASE=MSP;" & _
          "UID=sa;PWD=;].[SQLTbl];"

    CN.Execute SQL
    Set CN = Nothing

   On Error GoTo 0
   Exit Sub

ADOSQL2ACCESS_Error:
    MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure ADOSQL2ACCESS of Form Form1"
End Sub

Private Sub ADOACCESS2SQL()
On Error GoTo ADOACCESS2SQL_Error

    KonekDB

    SQL = "Select * INTO " & _
          "[ODBC;Driver=SQL Server;Server=(Local);Database=MSP;" & _
          "UID=sa;PWD=;].[SQLTbl] " & _
          "From AccessTbl"

    CN.Execute SQL
    CN.Close
    Set CN = Nothing

   On Error GoTo 0
   Exit Sub

ADOACCESS2SQL_Error:
    MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure ADOACCESS2SQL of Form Form1"
End Sub


Private Sub Command1_Click()
    ADOACCESS2SQL
End Sub

Private Sub Command2_Click()
    ADOSQL2ACCESS
End Sub

Semoga Bermanfaat,

Admin


How helpful was this article to you?

Related Articles

article Transfer File antar Komputer Lewat Networking dengan Visual Basic 6.0
 Server :  Client :

(No rating)  3-9-2010    Views: 2320   
article Backup dan Restore Access Database | CO-BackupAccess 1.0

(No rating)  2-8-2010    Views: 1546   
article Software CO-Backup 2.0 membuat otomatis Backup dan Restore Dabase SQLServer 2000
Software CO-Backup 2.0...

(No rating)  11-2-2009    Views: 2389   

User Comments

Add Comment
Comment Ebiet <bith_march@yahoo.com>
3-2-2010 at 2:03pm

Permisi
apakah sy bisa dibantu dikirimkan listing program VB 6.0 tentang transfer data (link) antar database dari microsoft access ke microsoft acces (antar ms.access), saya butuh sekali..
kalau bisa saya jg dikirimkan semacam modul tentang kiat2 transfer antar database ya...trims...
Comment arif surahman <abeu.4jji.85@gmail.com>
3-22-2010 at 3:23am

salam kenal
makasih dah mau berbagi ilmunya
Comment ipul <sa8887@gmail.com>
10-28-2010 at 10:35pm

salam
sukses slallu cak
Comment budi <asbudip@yahoo.com>
12-31-2010 at 6:41am

transfer data sql to sql
minta bantuannya dong untuk source code transfer data sql to sql dengan automatic transfer dgn timer, butuh sekali nih. Ok trims bnyk ya...dtnggu bgt jawabannya.



Status YM
Copyright © 2009 cimahi-one.com