Reputation: 925
I am using the below code -- well trying to at least. But I can't I get a Access Violation Error when it hits the OpenCurrentDatabase Line. "Attempted to read or write protected memory. This is often an indication of the other memory is corrupt"
Microsoft.Office.Interop.Access.Application oAcc = new Microsoft.Office.Interop.Access.Application();
oAcc.OpenCurrentDatabase(@"C:\\Test\\Test.mdb", false, "");
oAcc.DoCmd.RunSQL("Select empName, empAddress, empPhone FROM employeeInfo");
oAcc.DoCmd.Save(AcObjectType.acQuery, "Query_Built_Via_C#");
EDIT ---------------- And the database is closed when I attempt to run this command.
Upvotes: 0
Views: 62
Reputation: 250
The syntax that you are using looks good. I think this issue is that you are using the @ and escaping the slashes. You should use one or the other, but not both.
Try this instead. @"C:\Test\Test.mdb"
Upvotes: 2