1
Answer

not able to generate pdf file from crystal report

Madhav

Madhav

8y
381
1
i have done code for pdf generation and that is absolutly working on local host  but on another machine i am accessing the same application with the help of IIS server ,But the code i have done that is not able to generate PDF file on another machine and also not able to generate file name dyanamically,where as these things absolutly working on local host(machine on which i have developed application)
the code is as bellow  
 
protected void Button2_Click(object sender, EventArgs e)
{
int QuotationId = Convert.ToInt32(Session["QuotationId"]);
lbl_QuotationId.Text = QuotationId.ToString();
CrystalReportViewer1.Visible = true;
SqlConnection connection = new SqlConnection(CS);
SqlConnection connection1 = new SqlConnection(CS);
connection.Open();
SqlCommand command = new SqlCommand("Select QuotationId,Comp_CompanyName,Comp_CompanyCity,Comp_CompanyAddress,comp_Pin,comp_ContactNo,cust_CustomerName,Desccription,Price,Quantity,LineTotal,Country,DeliveryPeriod,Excise,Taxes,Freight,PayementTerms,RexrothPartNo From quotation where QuotationId=" + lbl_QuotationId.Text.Trim() + "", connection);
SqlDataAdapter adapter = new SqlDataAdapter(command);
FinalQuotation1 dataset = new FinalQuotation1();
adapter.Fill(dataset);
ReportDocument Report = new ReportDocument();
Report.Load(Server.MapPath("FinalQuotationReport.rpt"));
Report.SetDataSource(dataset.Tables[1]);
CrystalReportViewer1.ReportSource = Report;
Report.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Response, true,"IND " + lbl_QuotationId.Text.Trim()+"_FY15_16"+".pdf");
}
 
need help
Thanks in advance 
 
Answers (1)