Export Access report as PDF

Viewed 1933

I'm doing an ASP.NET application in C# that connects to an Access database and now I want that it exports a report as PDF. Here is my code that only connects to Access, I was thinking of running an access macro or running a command with Microsoft.Office.Interop.Access.Application DoCmd.OutputTo but I do not know how to use it exactly. Any help?

string user = "myUser";
string pass = "myPass";
string host = "myHost";
OleDbConnection connection = new OleDbConnection(@"Provider = Microsoft.ACE.OLEDB.12.0; Data Source = myPath");
string _command = ...; //I don't know what put here

try
{
    OleDbCommand command = new OleDbCommand(_command, connection);
    command.CommandText = ...; //I don't know what put here
    int temp = command.ExecuteNonQuery();
    Console.WriteLine("PDF created!");
 }
1 Answers
Related