Click here to Skip to main content
16,020,249 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
DataSet ds = new DataSet();

DataTable dt1 = new DataTable();
dt1.Columns.Add("CourseNo", typeof(string));
dt1.Columns.Add("CourseName", typeof(string));
dt1.Columns.Add("Quiz", typeof(float));
dt1.Columns.Add("Attandance", typeof(float));
dt1.Columns.Add("Final", typeof(float));
dt1.Columns.Add("Total", typeof(float));
dt1.Columns.Add("GradePoint", typeof(float));
dt1.Columns.Add("Grade", typeof(string));


ItemCollection items = dataGrid1.Items;
List<detail2> marks = new List<detail2>();

foreach (var col in items)
{
if (col is DataRowView)
{
detail2 obj1 = new detail2();
System.Data.DataRowView current = (System.Data.DataRowView)col;
var array = current.Row.ItemArray;
obj1.CourseNo = (string)array[0];
obj1.CourseName = (string)array[1];
// obj.GPA = float.Parse(array[2].ToString());

obj1.Quiz = float.Parse(array[2].ToString());
obj1.Attandance = float.Parse(array[3].ToString());
obj1.Final = float.Parse(array[4].ToString());
obj1.Total = float.Parse(array[5].ToString());
obj1.GradePoint = float.Parse(array[6].ToString());
obj1.Grade = (string)array[7];
//students.Add(studnet);
marks.Add(obj1);
}

}
// DataTable testDt = (DataTable)dataGrid1.ItemsSource;

foreach (detail2 dgv in marks)
{
// dt.Rows.Add(dgv.id, dgv.name, dgv.address);
dt1.Rows.Add(dgv.CourseNo, dgv.CourseName, dgv.Quiz, dgv.Attandance, dgv.Final, dgv.Total, dgv.GradePoint, dgv.Grade);
//break;
}

ds.Tables.Add(dt1);
ds.WriteXmlSchema("AdminStudentMarksheet.xml");

AdminStudentMarksheet ob2 = new AdminStudentMarksheet();
ob2.Show();

AdminStudentMarksheetCrystalReport cr = new AdminStudentMarksheetCrystalReport();
cr.SetDataSource(ds);


//error showing in below line
string ID = comboBox4.Text.ToString();
cr.SetParameterValue("@ID", ID); //error

//ob1.crystalReportViwer1.ViewerCore.ReportSource = cr;
ob2.crystalReportsViewer1.ViewerCore.ReportSource = cr;
Posted
Comments
thatraja 5-Dec-13 2:02am    
what's the error? include that in your question always
thatraja 5-Dec-13 10:53am    
Glad, you have solved your issue

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