即使我运行查询后,Crystal报表字段仍为空白...查询来自多个表

时间:2014-12-15 18:16:15

标签: c# sql-server crystal-reports report

我想做的是在一个Crystal Report文件或页面中显示两个表的数据。它带来了字段,但是当我运行查询时,它不会显示报告中的任何数据。 仅供参考,我使用相同的查询从sql server中提取数据以填充GridView,它已经有效。

        private void employee_report_Load(object sender, EventArgs e)
        {
        DAL d = new DAL();        // It is a separte C# class in which i have created connection
        d.connect();

        d.cmd.CommandText = "SELECT employee.emp_id, employee.first_name, employee.last_name, employee.gender, employee.dob, employee.city, employee.province, employee.phone_number, employee.email, employee.designation, department.department_name FROM department, employee WHERE employee.department_id = department.department_id AND is_deleted = 0";
        d.cmd.Connection = d.con;

        d.da.SelectCommand = d.cmd;
        d.da.Fill(d.dt);

        d.disconnect();

        ReportDocument rd = new ReportDocument();
        rd.FileName = "emp_report.rpt";
        rd.SetDataSource(d.dt);

        report_employee.ReportSource = rd;
        report_employee.Refresh();

    }

0 个答案:

没有答案