i have this code :
ReportDocument reportDocument1 = new ReportDocument();
reportDocument1.Load(Request.PhysicalApplicationPa th +
"\\reports\\VBilancio.rpt");
reportDocument1.SetDataSource(dsBil);
string TargetFileName;
FileStream fs;
long FileSize;
ExportOptions oExO;
DiskFileDestinationOptions oExDo = new DiskFileDestinationOptions();
TargetFileName = Request.PhysicalApplicationPath + "\\Export\\" +
Session.SessionID + "bilancio.pdf";
oExDo.DiskFileName = TargetFileName;
oExO = reportDocument1.ExportOptions;
oExO.ExportDestinationType = ExportDestinationType.DiskFile;
oExO.ExportFormatType = ExportFormatType.PortableDocFormat;
oExO.DestinationOptions = oExDo;
reportDocument1.PrintOptions.PaperOrientation=Pape rOrientation.Landscape;
reportDocument1.SetParameterValue("data_fine",data 2);
reportDocument1.SetParameterValue("data_ini",data1 );
reportDocument1.Export();
reportDocument1.Close();
Response.Clear();
Response.Buffer = true;
Response.AddHeader("Content-Type", "application/pdf");
Response.AddHeader("Content-Disposition",
"attachment;filename=ReportBilancio.pdf;");
fs = new FileStream(TargetFileName, FileMode.Open);
FileSize = fs.Length;
byte[] bBuffer = new byte[(int)(FileSize)];
fs.Read(bBuffer, 0, (int)(FileSize));
fs.Close();
Response.BinaryWrite(bBuffer);
Response.Flush();
Response.Close();
this code was ok with visual studio .net 2003 but with visual studio 2005
dont'work and appears an error similar to this :
error in the motor of the query
the permissions are ok and the the virtual directory is ok
what can he be?
thanks a lot
Micky
"Ignacio Machin ( .NET/ C# MVP )" wrote:
Hi,
"Andrew Hayes" <An*********@discussions.microsoft.comwrote in message
news:eb**************@TK2MSFTNGP05.phx.gbl...
Using VS 2005, CR10, writing in C#.NET.
How do I open a report, change the dataset, and export the results to PDF
from code without any user interaction?
Just doing it :)
Instantiate the report, get the dataset, use ReportDocument.SetDataSource(
theDataSet )
Then use ReportToDisk to export it in pdf format
and you are ready :)
Let me know if you need code, but it;s very straighforward.
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation