Problem to load crystal report with dataset.

dcmphi

Member
Joined
Sep 14, 2017
Messages
10
Programming Experience
Beginner
I have created a crystal report with date parameter with access db. My form has two text field one is


txtFormDate, other is txtToDate. My crystal report is run with date parameter but data not show.


Example: My access db table is tblTransaction and it has 5 Column ID, TDate, BillNo, Taka, Vat. It has


some data following dated:


TDate BillNo Taka Vat
18/10/2017 123/4521 105 5
20/10/2017 235/4562 110 5
21/10/2017 254/5689 402 20
06/11/2017 245/5689 118 6
06/11/2017 249/5989 220 9


when i input date parameter between 06/11/2017 to 06/11/2017 or 21/10/2017 to 06/11/2017 data not


show. Please anybody help?


N.B: my access db table TDate field data type is short text and i use my crystal parameter is string. I have used dataset to load crystal report.


Here is my form Code:


C#:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MyApplication.TransactionDataSetTableAdapters;
using System.Data.OleDb;
using System.Configuration;
using CrystalDecisions.CrystalReports.Engine;


namespace MyApplication
{
    public partial class TransactionReport : Form
    {                
        private OleDbConnection connection = new OleDbConnection();
        
        public TransactionReport()
        {
            InitializeComponent();
            connection.ConnectionString = (@"Provider = Microsoft.Jet.OLEDB.4.0; Data Source = E:\db


\BPS.mdb; Jet OLEDB:Database Password = bdinfo;");
            
        }


        private void btnOk_Click(object sender, EventArgs e)
        {
            try
            {
                Report rep = new Report();
                TransactionDataSet ds = new TransactionDataSet();
                qrytransactionTableAdapter adp = new qrytransactionTableAdapter();
                adp.Fill(ds.qrytransaction);
                rep.SetDataSource(ds);
                rep.SetParameterValue("FromDate",txtFromDate.Text);
                rep.SetParameterValue("ToDate", txtToDate.Text);
                crystalReportViewer1.ReportSource = rep;
            }
            catch (Exception x)
            {
                MessageBox.Show(this, "" + x, "Error", MessageBoxButtons.OK, MessageBoxIcon.Stop);


            }


        }
    }
}
 
Back
Top Bottom