Dim count As Integer = 0 Dim table As DataTable = New DataTable Dim accConnection As New OleDb.OleDbConnection("Provider=Microsoft.JET.OLEDB.4.0; Data Source='C:\Machine.mdb';User Id=admin; Password=;") Dim sqlConnection As New SqlClient.SqlConnection("Data Source=10.75.24.94;Initial Catalog=CTData;User ID=sql;Password=") Try 'Import the Access data accConnection.Open() Dim accDataAdapter = New OleDb.OleDbDataAdapter("SELECT * FROM Slot_Vision_Counters_table", accConnection) accDataAdapter.Fill(table) accConnection.Close() 'Export to MS SQL For Each row As DataRow In table.Rows row.SetAdded() count = count + 1 Next ### Code for inserting the data to SQL? Catch ex As Exception If accConnection.State = ConnectionState.Open Then accConnection.Close() End If If sqlConnection.State = ConnectionState.Open Then sqlConnection.Close() End If MessageBox.Show("Import failed with error: " & Environment.NewLine & Environment.NewLine _ & ex.ToString) End Try
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)