Thursday, March 19, 2009

Code Behind of RDLC Reporting

ReportViewer1.Visible = true;
SqlConnection thisconn = new SqlConnection(conn);
System.Data.DataSet thisDataSet = new System.Data.DataSet();
SearchValue[0] = new SqlParameter("@CategoryID",tbxCustomerId.Text);
SqlCommand cmd=new SqlCommand();
CustomerDatasetTableAdapters.CustomerTableAdapter daCustomer=new CustomerTableAdapter();
ReportDataSource dataSource = new ReportDataSource("CustomerDataset_Customer",thisDataSet.Tables["Customer"]);
dataSource.Value = daCustomer.GetDataBy(Convert.ToInt32(tbxCustomerId.Text));
ReportDataSource("DataSetProducts_ShowProductByCategory",thisDataSet.Tables[0]);
ReportViewer1.LocalReport.DataSources.Clear();
ReportViewer1.LocalReport.DataSources.Add(dataSource);
ReportViewer1.LocalReport.Refresh();

No comments:

Post a Comment