我正在用 C# 编写一个连接到 Access 数据库的 ASP.NET 应用程序,现在我希望它将报告导出为 PDF。这是我的代码,仅连接到 Access,我正在考虑运行访问宏或使用 Microsoft.Office.Interop.Access.Application DoCmd.OutputTo 运行命令,但我不知道如何准确使用它。有什么帮助吗?
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!");
}
Run Code Online (Sandbox Code Playgroud)