richard smith

richard smith

  • 1.4k
  • 285
  • 160.1k

C# to Create Access Query

Apr 16 2014 3:33 PM
Can you use this syntax to open an access database - create a query - then save the query - then close the database?
 
 [code]
Microsoft.Office.Interop.Access.Application accessApp = new Microsoft.Office.Interop.Access.Application();
accessApp.OpenCurrentDatabase(@"C:\\Test\\Test.mdb", false, "");
accessApp.DoCmd.RunSQL("Select * FROM tableData");
accessApp.DoCmd.Save(AcObjectType.acQuery, "All");
[/code]