rdlc报告没有显示任何内容

时间:2017-07-09 10:12:42

标签: c# sql-server rdlc

我的数据gridview确实有效但rdlc报告没有显示任何内容。 我有report.rdlc个文件和dataset(DataSet1),其中包含datatable(DataTable1)。我的数据表有两列WnameCcode,它们都是string

SqlConnection scon = new SqlConnection(@"data source=(LocalDB)\v11.0;attachdbfilename=|DataDirectory|\PCPdb.mdf;integrated security=True;connect timeout=30;MultipleActiveResultSets=True");
string query = "SELECT Wname,Ccode FROM tbl_Worker wk inner join tbl_Contract cont on wk.Wcode=cont.CWcode WHERE wk.Wcode=1122";
DataTable dt = new DataTable();
dt.TableName = "DataTable1";
SqlCommand scm = new SqlCommand(query, scon);
SqlDataAdapter sda = new SqlDataAdapter(scm);
scon.Open();
scm.ExecuteNonQuery();
sda.Fill(dt);
dataGridView1.DataSource = dt;

ReportDataSource rds = new ReportDataSource();
rds.Name = "DataSet1";
rds.Value = dt;
reportViewer1.LocalReport.DataSources.Add(rds);
this.reportViewer1.RefreshReport();
scon.Close();

0 个答案:

没有答案