locked
Import rows from sql to access RRS feed

  • Question

  • User1443511503 posted

    Hi,

    I need to update access table with records from my sql table. How can I do this?

    I tried code below but it will insert the data into brand new table in access and I need to insert rows into an existing table...

    Dim objConnection As OleDbConnection

    objConnection = New OleDbConnection(My.Settings.JobCostingConnectionString_Access)

    Dim objCommand As OleDbCommand

    objCommand = New OleDbCommand

    objCommand.CommandText = "SELECT * INTO [tblTransaction] FROM [ODBC;Driver=SQL Server; SERVER=servername\SQLEXPRESS; DATABASE=JCTimeSheet;Integrated Security=True].[tblTransaction]"

    objCommand.Connection = objConnection

    Dim da As OleDbDataAdapterda = New OleDbDataAdapter

    da.UpdateCommand = objCommand

    objConnection.Open()

    da.UpdateCommand.ExecuteNonQuery()

    objConnection.Close()

    Please help,

    Paul

    Tuesday, December 16, 2008 7:20 AM

Answers

  • User-821857111 posted

    Try INSERT INTO tblTransaction SELECT * FROM......

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, December 16, 2008 7:49 AM