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;
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));

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 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.