http://expert.csdn.net/Expert/topic/2291/2291055.xml?temp=.7053186

解决方案 »

  1.   


    if (this.Drop_count.SelectedItem.Text=="职务统计")
    {
    //实例化报表类
    dutyReport Duty=new dutyReport();
    //查询SQL语句
    StrSql="select id,emp_id,name,duty_id,dep_id,address,nationality,locate,";
    StrSql+="folk,government,sex,birthday,home_tel,postal_code,office_tel,mobil,";
    StrSql+="email,recored,lang_type,specialty,school,sch_date,card_id,write_date,";
    StrSql+="res,case flag when 'a' then '在职' when 'b' then '试用' when 'c' then '离职' end as flag,";
    StrSql+="photo from hr_employee where flag<>'c'";
    //读出数据
    Adapter=new SqlDataAdapter(StrSql,Connection.SqlConn);
    //将数据保存在数据集中
    Adapter.Fill(CountSet,"hr_employee");
    //给报表绑定数据
    Duty.SetDataSource(CountSet);
    //显示报表
    this.Report.ReportSource=Duty;
    }