i am using the crystal report in c# web application. there is a problem that the crystal report load last record from For loop.
i stores the code of product in for loop as code. and according to that single or multiple code the the crystal report shows info. of that product.
i use….
for (int i = 0; i < code.Length; i++)
{
string str = "select crbal*-1 as crbal, glname, contprsn, refby, glphone1, glcity, glphone2, email, crlimit, restorddueamt from db1.dbo.glmast WHERE drgroup='A3402' and crbal<>0 and glcode="+code[i]+ "";
SqlDataAdapter ad = new SqlDataAdapter(str, con2);
DataSet ds = new DataSet();
ad.Fill(ds);
path = Server.MapPath("ERP_REPORT_MAIN.rpt");
cr = new ReportDocument();
cr.Load(path);
cr.SetDataSource(ds.Tables[0]);
CrystalReportViewer1.ReportSource = cr;
}
if, there is two code in for loop it display last record only. please Help Me.
Thanks and Regards…
Mitesh
I would revise the code, and make also some slight efficiency improvments: