Salman Mushtaq

Salman Mushtaq

  • NA
  • 284
  • 208.5k

Generate RDLC report using LINQ

Nov 7 2017 8:46 AM

my database structure is like

ID, DESCRIPTION, VALUE 

when I try to generate the RDLC report I do

  1. Add Report.rdlc
  1. Add Dataset
My Code:
 
  1. private void load_profile_btn_Click(object sender, EventArgs e)  
  2. {  
  3. historicalData_gb.Visible = false;  
  4. DataSet1TableAdapters.Load_ProfileTableAdapter tb4 = new DataSet1TableAdapters.Load_ProfileTableAdapter();  
  5. DataSet1.Load_ProfileDataTable ds = tb4.GetData();  
  6. Microsoft.Reporting.WinForms.ReportDataSource reportDataSource4 = new Microsoft.Reporting.WinForms.ReportDataSource("Load_Profile", ds.AsEnumerable().CopyToDataTable());  
  7. reportViewer1.LocalReport.DataSources.Clear();  
  8. reportViewer1.LocalReport.DisplayName = "Load Profile";  
  9. reportViewer1.LocalReport.ReportPath = @"C:\Users\SalmanMushtaq\documents\visual studio 2013\Projects\Sec_Report_Rdlc\Sec_Report_Rdlc\load_profile.rdlc";  
  10. reportViewer1.LocalReport.DataSources.Add(reportDataSource4);  
  11. reportViewer1.RefreshReport();  
  12. }  

Now the report will appear like

ID, DESCRIPTION, VALUE

But I need to show the report like DESCRIPTION have 3 kind of entry i.e. P1,P2,P3 so I need to show like ID, P1, P2, P3, VALUE

For this I add Model "Linq to Sql" and now I need to show the report as I explain above. Please help.

 
 
 

Answers (1)