Hi friends,
I am generating reports in my application using Microsoft reports but i am getting error as
"An error has occurred during report processing.The type specified in the TypeName property of ObjectDataSource 'ObjectDataSource2' could not be found".
Can Any one help me.
I am new to reporting and it would be very helpful if some one explain me how to generate Microsoft reports(Not Crystal reports).
Thanks
Loading
dinaPosted Oct 13, 2010, 6:16 PM
public static Dataset getData(){
DataTable temp = new DataTable();
temp.Columns.Add("ID");
temp.Columns.Add("Name");
DataRow dr = temp.NewRow();
dr[0] = "1";
dr[1] = "Rajath";
temp.Rows.Add(dr);
DataRow dr1 = temp.NewRow();
dr1[0] = "2";
dr1[1] = "Yashvant";
temp.Rows.Add(dr1);
temp.TableName = "temp";
DataSet DataSet1 = new DataSet();
DataSet1.Tables.Add(temp);
retun Dataset1;
}
in code behind:
re1.LocalReport.ReportPath="Report11.rdlc";
Microsoft.Reporting.WebForms.ReportDataSource src = new Microsoft.Reporting.WebForms.ReportDataSource();
src.Name="DataSet1_temp";
src.Value=yourclass.getData();
re1.LocalReport.DataSources.Add(src);
your custom class with it's fields must appear in "website data source" windows in Repot1.rdlc
hope that helps
Suthish NairPosted Oct 13, 2010, 5:45 PM
rajath rPosted Oct 13, 2010, 3:09 AM
I have created dataset with name "DataSet1" and table in it with name "temp". I have also created report.
Still I am not able to get object to set value for datasource of reports. My code in code behind is:
DataTable temp = new DataTable();
temp.Columns.Add("ID");
temp.Columns.Add("Name");
DataRow dr = temp.NewRow();
dr[0] = "1";
dr[1] = "Rajath";
temp.Rows.Add(dr);
DataRow dr1 = temp.NewRow();
dr1[0] = "2";
dr1[1] = "Yashvant";
temp.Rows.Add(dr1);
temp.TableName = "temp";
DataSet DataSet1 = new DataSet();
DataSet1.Tables.Add(temp);
re1.LocalReport.ReportPath=Server.MapPath("Report11.rdlc");
Microsoft.Reporting.WebForms.ReportDataSource src = new Microsoft.Reporting.WebForms.ReportDataSource();
src.Name="DataSet1_temp";
// src.Value=
re1.LocalReport.DataSources.Add(src);
re1.DataBind();
Thanks in advance.
dinaPosted Oct 12, 2010, 3:22 PM
then create report file (using "add existing item" wizard) say it's name will be (myreport.rdlc)
//in code behind
// create instance of the dataset that you 've created earlier and fill it withdata coming frm sqldatareader
//then binding report with the source
ReportViewer1.LocalReport.ReportPath="myreport.rdlc";
ReportDataSource src=new ReportDataSource();
src.Name="ds_dt"; (//ie "datasetname_datatablename")
src.value=dsobj; //the object that you created in code behind
Reportviewer1.LocalReport.DataSources.Add(src);
the report should be displayed on page