Chidiebere Mgbemena

Chidiebere Mgbemena

  • NA
  • 179
  • 14.2k

Crystal Reports wont load data

Jun 13 2020 10:03 AM
Hello guyz ,
 
i tried to load Bill between two numbers using crystal Reports am getting these errors:
 
what could be the problem?
 
thanks 
 
 
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 BillsBetweenTwoNos : Form
{
SqlConnection con = new SqlConnection(Properties.Settings.Default.NSPM_Sales_InvoiceCon);
ReportDocument Cryrpt = new ReportDocument();
SqlDataAdapter dr;
public BillsBetweenTwoNos()
{
InitializeComponent();
}
private void btnFindJobs_Click(object sender, EventArgs e)
{
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 Tbl_HeaderData.JobNo Between '"+textBox1.Text+"' and '"+textBox2.Text+"' ", con);
DataSet dst = new DataSet();
da.Fill(dst, "PrintBills");
Cryrpt.Load("BillsBetweenTwoNumbers.rpt");
Cryrpt.SetDataSource(dst.Tables[0]);
crystalReportViewer1.ReportSource = Cryrpt;
con.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void BillsBetweenTwoNos_Load(object sender, EventArgs e)
{
textBox1.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 Tbl_HeaderData.JobNo Between '" + textBox1.Text+"' and '"+textBox2.Text+"' ", con);
DataSet dst = new DataSet();
da.Fill(dst, "PrintBills");
Cryrpt.Load("BillsBetweenTwoNumbers.rpt");
Cryrpt.SetDataSource(dst.Tables[0]);
crystalReportViewer1.ReportSource = Cryrpt;
con.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
Class1.strinv = "";
}
}
}

 

 

 
 
 

Answers (6)