Click here to Skip to main content
15,886,796 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear expect ,
I have generated records which are in a table.

I have placed a reportview on a form with the report attached.

However the data is just not coming out.

Please assist by correcting the codes below




string str;
              str = ConfigurationManager.ConnectionStrings["ApplicationServices"].ConnectionString;
              SqlConnection sqlCon = new SqlConnection(str);
              sqlCon.Open();

              SqlDataAdapter daa = new SqlDataAdapter("select * from SCHEDULE", sqlCon);
              DataSet dsasa = new DataSet();
              daa.Fill(dsasa, "SCHEDULE");

              ReportViewer1.Visible = true;
              ReportViewer1.Reset();

              ReportViewer1.LocalReport.Refresh();
              ReportViewer1.Reset();
Posted
Comments
[no name] 8-Aug-14 20:19pm    
And where are you setting the data source for your report?
Member 10744248 8-Aug-14 20:37pm    
Please provide me with the general steps for getting the codes.
Member 10744248 8-Aug-14 20:39pm    
Please provide the general steps for generating reports in codes

1 solution

C#
Microsoft.Reporting.WebForms.ReportDataSource[] RSArray = new Microsoft.Reporting.WebForms.ReportDataSource[1];
ReportViewer1.Visible = true;
ReportViewer1.LocalReport.DataSources.Clear();
ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("dsRatingReport", dsRatingReport.Tables(0)));
ReportViewer1.LocalReport.Refresh();
 
Share this answer
 
Comments
Member 10744248 9-Aug-14 7:45am    
Having error around


<pre> <b> ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("Schedule", ds.Tables[0]));</b></pre>


<pre>ReportDataSource(</pre>


Please review the codes and correct.


Thanks


<pre> Microsoft.Reporting.WebForms.ReportDataSource[] RSArray = new Microsoft.Reporting.WebForms.ReportDataSource[1];

SqlConnection connect = new SqlConnection();
connect.ConnectionString = ConfigurationManager.ConnectionStrings["ApplicationServices"].ConnectionString;
connect.Open();
SqlDataAdapter da = new SqlDataAdapter("select * from Schedule", connect);

DataSet ds = new DataSet();
da.Fill(ds, "Schedule");


ReportViewer1.Visible = true;
ReportViewer1.LocalReport.Refresh();

ReportViewer1.LocalReport.DataSources.Clear();
ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("Schedule", ds.Tables[0]));
ReportViewer1.LocalReport.Refresh();</pre>
Jignesh Khant 9-Aug-14 7:49am    
check if your .rdlc file also has this dataset. ie Schedule
Member 10744248 9-Aug-14 12:19pm    
ReportDataSource seem not to be a key word in vs 2010 it does not appear in the Intellisense
Jignesh Khant 11-Aug-14 0:56am    
include 'Microsoft.Reporting.WebForms' class which contains ReportDataSource .

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900