ranj_s20 0 Newbie Poster

Following is the code i used for exporting crystal report on to a pdf file on a buttonclick.The back end used is sqlserver2005 .The problem am facing is the whole records in the database is showing instead of the single record i've been searching for
System.IO.FileStream fs = null;
long FileSize = 0;

DiskFileDestinationOptions oDest = new DiskFileDestinationOptions();

string ExportFileName = Server.MapPath("\\JDDraftSanction.rpt") + "Export";
oRpt.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
oRpt.ExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
oDest.DiskFileName = ExportFileName;
oRpt.ExportOptions.DestinationOptions = oDest;
oRpt.Export();
Response.Clear();
Response.Buffer = true;
Response.AddHeader("Content-Type", "application/pdf");
Response.AddHeader("Content-Disposition", "attachment;filename=SanctionOrder.pdf;");
fs = new System.IO.FileStream(ExportFileName,FileMode.Open);
FileSize = fs.Length;
byte[] bBuffer = new byte[Convert.ToInt32(FileSize) + 1];
fs.Read(bBuffer, 0, Convert.ToInt32(FileSize));
fs.Close();
Response.BinaryWrite(bBuffer);
Response.Flush();
Response.Close();

Am using creating crystal report using selection formula.I cannot identify the problem..Some help me please...........Thank u.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.