高手请帮看下那里出错了,整了三天没解决.
private void cs_tj_Load(object sender, EventArgs e)
{
this.reportViewer1.LocalReport.SubreportProcessing += new Microsoft.Reporting.WinForms.SubreportProcessingEventHandler(SubReportProcessingEventHandler);
string ls_sql = "select nf 年份,gzbh 编码,xm 姓名,xh 序号,jxf 绩效,d_s 个人所得税,j_gwgz 岗位工资,j_xjgz 薪级工资,j_jh 教护,b_xgtxf 通讯费,b_bt 补贴,b_zgbt 在岗补贴,b_bf 补发,k_bsj 病事假扣款,g_yl 养老金,g_sy 失业金,g_gjj 公积金,g_ylj 医疗金,g_dej 大额医疗金,d_kk 代扣款,fl1,bz from t_gzb ";
SqlCommand cmd = new SqlCommand(ls_sql, myconnection);
SqlDataAdapter adapter = new SqlDataAdapter(cmd);
dt = new DataSet();
dt.Tables.Add("t_gzb");
adapter.Fill(dt, "t_gzb");
if (dt.Tables[0].Rows.Count == 0)
{
MessageBox.Show("無數據可供你查詢,請重新輸入查詢條件 ");
return;
}
// TODO: 这行代码将数据加载到表“rsgzDataSet.T_ksb”中。您可以根据需要移动或删除它。
this.T_ksbTableAdapter.Fill(this.rsgzDataSet.T_ksb);
// TODO: 这行代码将数据加载到表“rsgzDataSet.t_gzb”中。您可以根据需要移动或删除它。
this.reportViewer1.RefreshReport();
}
private void button1_Click(object sender, EventArgs e)
{
ReportParameter rp = new ReportParameter("anf", this.textBox1.Text);
this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] {rp});
this.reportViewer1.RefreshReport();
}
private void SubReportProcessingEventHandler(object sender, Microsoft.Reporting.WinForms.SubreportProcessingEventArgs e)
{
e.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("DataSetsj",dt.Tables["t_gzb"]));
}