Click here to Skip to main content
15,900,725 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am trying to bind typesd dataset to crystal report but data is not displayed on crystal reports.
Posted
Comments
thatraja 4-Aug-10 1:10am    
you should mention full details regarding Error or something....

1 solution

ReportDocument objCrystalReport = new ReportDocument();
objCrystalReport.Load(AppDomain.CurrentDomain.BaseDirectory + @"..\StudentRecord.rpt");
objDataSet.Clear();
objDataSet.ReadXml(AppDomain.CurrentDomain.BaseDirectory + @"..\StudentData.xml");
StudentRecordData objRecords = new StudentRecordData();
Program.LoadForm = true;
if (objDataSet != null && objDataSet.Tables.Count > 0)
{
if (objDataSet.Tables[0].Rows.Count > 0)
{
int counter = 0;
foreach (DataRow objRow in objDataSet.Tables[0].Rows)
{
if (counter < ((int)(objDataSet.Tables[0].Rows.Count) / 2))
{
objRecords.Student.ImportRow(objRow);
}
else
{
objRecords.Student_Addition.ImportRow(objRow);
}
counter++;
}
}
else
{
MessageBox.Show("Not able to Create Report");
Program.LoadForm = false;
this.Close();
}

objCrystalReport.SetDataSource(objRecords);
crystalReportViewer1.ReportSource = objCrystalReport;
crystalReportViewer1.Show();
 
Share this answer
 

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