报表查看器仅显示一条记录

时间:2015-05-09 11:33:06

标签: c# reportviewer rdlc

我目前有一个报告,我通过参数传递,但它只显示参数的单个记录(它可以找到的第一个记录)。

在我的数据集中查询:

SELECT CID, HID, Customer_Name, Appointment_Date, Appointment_Begin, Appointment_End, Room_No, RoomType, Discount FROM Appointment WHERE Appointment_Date = ?

我的RDLC设计

RDLC view

代码:

private void Report_Load(object sender, EventArgs e)
{
    using (OleDbConnection db_connection = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\KAZEM\Documents\Hairsalon\employees.accdb;
Persist Security Info=False;"))
    {
        String query = "SELECT Distinct Appointment_Date FROM Appointment";
        using (OleDbCommand db_command = new OleDbCommand(query, db_connection))
        {
            db_connection.Open();
            OleDbDataReader reader = db_command.ExecuteReader();
            while (reader.Read())
            {
                combo_AptDate.Items.Add(reader.GetString(0));
            }
        }
    }
}

private void combo_AptDate_SelectedValueChanged(object sender, EventArgs e)
{
    this.AppointmentTableAdapter.Fill(this.hairsalonDataset.Appointment, combo_AptDate.SelectedItem.ToString());

    this.reportViewer1.RefreshReport();
}

0 个答案:

没有答案