Hello, Here I'm directly passing the crystal reports parameters through the code, and generating the report but for some obvious reason, I want the records to be stored first of all into a 2-dimensional array and from there writing it back onto Crystal reports.
Note : The reason why I'm looking for 2-Dimensional array is that currently upon execution I'm getting a Crystal Report with repeated records and that too upto the no. of maximum records in table.
To be more clear, lets say, that I have an access database with 30,000 records and whn I generate the crystal report I'm expecting all 30,000 records to be displayed row-by-row. But instead of that I'm getting the first record repeated 30,000 times..........NEED HELP........!!!
The actual code before storing it in 2D-array is as given below:
private void btnReport_Click(object sender, System.EventArgs e){ try { makeReport(report_file); for (int recordCount=0; recordCount <= myTable.Rows.Count; recordCount++) { SetParamValue("@parameter1", myTable.Rows[recordCount]["CLNT#">.ToString)); SetParamValue("@parameter2", myTable.Rows[recordCount]"CNAME">.ToString)); SetParamValue("@parameter3", myTable.Rows[recordCount]["CSEX">.ToString)); SetParamValue("@parameter4", myTable.Rows[recordCount]["CSS#">.ToString()); crystalReportViewer1.ReportSource = ReportDoc; } } catch (Exception ex) { MessageBox.Show(ex.Message, "EXCEPTION"); }}
private void SetParamValue (string paramName, string paramValue){ for(int i=0; i<reportdoc.datadefinition.formulafields.count;> if(ReportDoc.DataDefinition.FormulaFields[i].FormulaName=="{" + paramName + "}") { ReportDoc.DataDefinition.FormulaFields[i].Text = """ +paramValue +"""; } crystalReportViewer1.ReportSource = ReportDoc; }
private void makeReport(string ReportFile) { ReportDoc.Load(ReportFile); // where ReportFile is the path of report (@"c:/reports/..)}
Software/Hardware used:
ASKED:
July 16, 2008 7:14 PM
UPDATED:
July 17, 2008 12:34 PM