This is an old article, but I still like the way the example comes together. It is a straightforward console application that connects to an MS Access database through the OleDb provider.
Original note from the old post: the actual draft date was 2008-05-19.
The idea was simple: create an Access database, connect to it from a console application, insert a record, then read it back and print the result.
First, create a table named MyTable with these fields:
IdasAutoNumberFullNameasText
That should look something like this:
Next, create a new console application in Visual Studio:
Add a reference to System.Configuration:
Then add an app.config file so you can keep the connection string outside the code:
Once that is in place, the connection helper can look like this:
| |
Then in Main() you can connect, insert a record, query it back, and print the result:
| |
That is really the whole point of the sample: use a simple console application with ADO.NET and the OleDb provider to work with an Access database.
Source downloads from the original post: