richard smith

richard smith

  • 1.5k
  • 285
  • 160.6k

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]