Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27514

ado - insert from one DB to another

$
0
0
Hi all, not too sure on how to craft this sql, I want to insert into an access database on a share path, from another access database on a share path, in vb.net using

Code:

        Dim cmd As OleDbCommand = New OleDbCommand()
        Dim sConStr As String = "Provider=Microsoft.jet.oledb.4.0;data source=localdb"
        Dim conn As OleDbConnection

        conn = New OleDbConnection(sConStr)

        cmd.Connection = conn
        cmd.CommandType = CommandType.Text
        cmd.CommandText = "SQL GOES HERE"              'INSERT INTO localdb SELECT table1 from DB2 ?

        conn.Open()
        cmd.ExecuteNonQuery() 'this should execute the sql to add the table
        conn.Close()

I cant seem to get the syntax right, does anyone have an example of that?

Viewing all articles
Browse latest Browse all 27514

Trending Articles