Question

How do I program against Access 2007 in C#? I don't see any VSTO templates for it. All I need to do is define a schema, let the user fill in the data on their own, and then read all of the data they entered back into my program. The reading part looks easy...how would I programmatically create a MS Access Database, and how would I hook up to know the user has closed the current database?

Thanks, Roy

Was it helpful?

Solution

You'll need to create a reference to Microsoft ActiveX Data Objects and do some InterOp work. There's a post here that will get you started.

UPDATE

Apparently that post is a bit dated and does not include some details specific to Access 2007.

Using the JET provider will not work with the new accdb file format. You will need to use the 2007 Office System Driver - Data connectivity Components (you can download it from here).

As mentioned in a comment below, you'll have to change your connection string to use the following provider: Microsoft.ACE.OLEDB.12.0.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top