I am automating Microsoft Access from C# like so:
using Microsoft.Office.Interop.Access;
static void Main(string[] args)
{
Application ap = new Application();
ap.OpenCurrentDatabase("C:\\location.accdb", true);
ap.DoCmd.WhateverIFeelLike();
ap.CloseCurrentDatabase();
}
What I want to do here is run one of the select queries stored within Access and return this value either as a string or string array.
I want something like this:
string[] myQueryResult = ap.DoCmd.OpenQuery("qryFoo");
Obviously this doesn't work but this the kind of thing that I am looking for. As a workaround I am thinking of exporting the query results to a CSV file then using Filehelpers to import this into an Array in C# but I thought I would ask on here first in the hope that there is a more direct route!
Thanks