I worked on a program a few years ago that takes data from a series of text files and loads an Access database. I added to the code from a program started by someone else, so I did not write the imports and declarations. They used an ADODB.recordset, addnew and recordset update to move the data into the table. My contribution was to extract information from some additional text files to send to the database. Here are the initial lines from the original program, which I tried to copy:
Imports System.IO
Imports System.Data.OleDb
Imports System.Text.RegularExpressions
Dim streamText As StreamReader
Dim con As New ADODB.Connection
Dim rstInput As ADODB.Recordset
I needed to write a similar program from scratch, imported the same system.data.oledb, but when I declare the connection and record set, I get the blue underline and "connection not defined" error. It appears to me that I am defining everything the same way as it was in the original program.
I worked around this by building an Insert Into statement, and that works.
I have 2 questions:
- How do I correctly create an ADODB connection and recordset?
- Is there an advantage to filling a record set with Addnew over an Insert Into?
Thanks for any help you can offer!