RDLCレポートのデータの動的バインド
string conStr = "Data Source=.;Initial Catalog=Book;Integrated Security=True";
SqlConnection con = new SqlConnection(conStr);
con.Open();
SqlDataAdapter da = new SqlDataAdapter("SELECT top 10 * from [dbo].[CuserInfo]", con);
BookDataSet ds = new BookDataSet(); /* DataSet*/
/* SqlDataAdapter DataTable ( ) */
da.Fill(ds.Tables["CuserInfo"]);
this.CuserInfoBindingSource.DataSource = ds.Tables["CuserInfo"];
this.reportViewer1.LocalReport.ReportEmbeddedResource = "MyRDLC.MyReport.rdlc";
/* : using Microsoft.Reporting.WinForms;
*
* ReportDataSource rds = new ReportDataSource("BookDataSet_CuserInfo", ds.Tables["CuserInfo"]);
* this.reportViewer1.LocalReport.DataSources.Add(rds);
*
*/
this.reportViewer1.LocalReport.DataSources.Clear();
/* */
this.reportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("BookDataSet_CuserInfo", ds.Tables["CuserInfo"]));
this.reportViewer1.RefreshReport();
内訳:BookDataSet_CuserInfo表示/*データセット名_表名*/ds.Tables["CuserInfo"]表示/*データソース(テーブル)*/DataSetにはできません