I have an MS Access database table that I exported to SQL Server 2012 without the data. So now I'd like to copy the data from the access table to the sql table line by line.
Dim conn As System.Data.OleDb.OleDbConnection = New System.Data.OleDb.OleDbConnection(Configuration.ConfigurationManager.ConnectionStrings("ACCESS_DB_DataConnectionString").ToString())
Dim comm As System.Data.OleDb.OleDbCommand = New System.Data.OleDb.OleDbCommand("Select * FROM " + accessTable)
Dim rdr As System.Data.OleDb.OleDbDataReader
Try
conn.Open()
rdr = comm.ExecuteReader
While rdr.Read
InsertRecord()
End While
rdr.Close()
Catch ex As Exception
'Error
Finally
comm.Dispose()
conn.Close()
conn.Dispose()
End Try
End Sub
Private Sub InsertRecord()
'What do I do here? Select into? But how?
End Sub
I don't want to use a regular insert because I don't care to type out all of the column names. The end goal is to copy what records I can and skip over and obtain the IDs of all the rows that error out.
Thank you
line by line
.