I got an error while trying to print bill with crystal report. The error is below
The multi part identifer HeaderDataJobNo could not be found.
Please help me find the solution to the error
thanks
my codes and sql below
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using System.Data.SqlClient;
- using CrystalDecisions.CrystalReports.Engine;
- namespace NSPM_Sales_Invoice
- {
- public partial class PrintBills : Form
- {
- SqlConnection con = new SqlConnection(Properties.Settings.Default.NSPM_Sales_InvoiceCon);
- ReportDocument Cryrpt = new ReportDocument();
- SqlDataAdapter dr;
- public PrintBills()
- {
- InitializeComponent();
- }
- private void PrintBills_Load(object sender, EventArgs e)
- {
- txtJobNo.Text = Class1.strinv;
- try
- {
- con.Open();
- 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 HeaderData.JobNo = '" + txtJobNo.Text + "'", con);
- DataSet dst = new DataSet();
- da.Fill(dst, "Tbl_HeaderData");
- Cryrpt.Load("PrintBill.rpt");
- Cryrpt.SetDataSource(dst);
- crystalReportViewer1.ReportSource = Cryrpt;
- con.Close();
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
- }
- }

