Chidiebere Mgbemena

Chidiebere Mgbemena

  • 1.7k
  • 173
  • 3.6k

Printing Bill using Crystal Reports

Jun 9 2020 8:51 PM
I tried to print bills through Crystal Reports but it is coming out blank.
 
 
 
any suggestions will be appreciated.
  1. using System;  
  2. using System.Collections.Generic;  
  3. using System.ComponentModel;  
  4. using System.Data;  
  5. using System.Drawing;  
  6. using System.Linq;  
  7. using System.Text;  
  8. using System.Threading.Tasks;  
  9. using System.Windows.Forms;  
  10. using System.Data.SqlClient;  
  11. using CrystalDecisions.CrystalReports.Engine;  
  12. namespace NSPM_Sales_Invoice  
  13. {  
  14. public partial class PrintBills : Form  
  15. {  
  16. SqlConnection con = new SqlConnection(Properties.Settings.Default.NSPM_Sales_InvoiceCon);  
  17. ReportDocument Cryrpt = new ReportDocument();  
  18. SqlDataAdapter dr;  
  19. public PrintBills()  
  20. {  
  21. InitializeComponent();  
  22. }  
  23. private void PrintBills_Load(object sender, EventArgs e)  
  24. {  
  25. txtJobNo.Text = Class1.strinv;  
  26. try  
  27. {  
  28. con.Open();  
  29. SqlDataAdapter da = new SqlDataAdapter("select Tbl_HeaderData.JobNo,Tbl_HeaderData.Date,Tbl_HeaderData.GoodValue,Tbl_HeaderData.Vat,Tbl_HeaderData.StampDuty,Tbl_HeaderData.DeliveryCharges,Tbl_HeaderData.OtherCharges,Tbl_HeaderData.Total,Tbl_RowData.SINo,Tbl_RowData.Customer, Tbl_RowData.Description,Tbl_RowData.Price,Tbl_Rowdata.Quantity,Tbl_RowData.Value,Tbl_RowData.JobNo from Tbl_HeaderData Inner Join Tbl_RowData on Tbl_HeaderData.JobNo = Tbl_RowData.JobNo Where Tbl_HeaderData.JobNo = '" + txtJobNo.Text + "'", con);  
  30. DataSet dst = new DataSet();  
  31. da.Fill(dst, "PrintBills");  
  32. Cryrpt.Load("PrintBill.rpt");  
  33. Cryrpt.SetDataSource(dst);  
  34. crystalReportViewer1.ReportSource = Cryrpt;  
  35. con.Close();  
  36. }  
  37. catch (Exception ex)  
  38. {  
  39. MessageBox.Show(ex.Message);  
  40. }  
  41. }  
  42. }  
  43. }  

Brought to you by: JavaScript SDK for Bold BI dashboard and analytics embedding. Free trial.

Answers (8)