0
我试图从Access报告中生成PDF。报告弹出的对话框“输入参数值”。我如何用C#填充它?它甚至是reportParameter(whereCondition)?如何在“输入参数值”对话框中插入文本?
using System;
using MsAccess = Microsoft.Office.Interop.Access;
namespace mdb2pdf
{
class Program
{
public static void Main(string[] args)
{
string MDBFile = @"d:\example.mdb";
string PDFFile = @"d:\example.pdf";
string reportName = @"myReport";
string reportParameter = @"[Name?] LIKE 'myName'";
MsAccess.Application app = new MsAccess.Application();
app.OpenCurrentDatabase(MDBFile, false, "");
app.DoCmd.OpenReport(reportName, Microsoft.Office.Interop.Access.AcView.acViewPreview, Type.Missing, reportParameter, MsAccess.AcWindowMode.acWindowNormal, Type.Missing);
app.DoCmd.OutputTo(MsAccess.AcOutputObjectType.acOutputReport, reportName, MsAccess.Constants.acFormatPDF, PDFFile, Type.Missing, Type.Missing, Type.Missing);
app.CloseCurrentDatabase();
}
}
}
为什么不把标准参数传递给OpenReport,而不必担心参数化SQL呢? – 2010-09-01 03:30:33