通过编码设置参数时,晶体报告显示最后一条记录 [英] crystal report display last record when set parameter by coding

查看:56
本文介绍了通过编码设置参数时,晶体报告显示最后一条记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hii ,,

我正在用C#报告.但是当我通过编码在c#中设置参数时出现问题,它仅显示一条记录.

我从列表框中发送多个值,但在Crystal Report中仅显示一个.

Hii,,

i am making a report in c#. but there is a problem when i set parameter in c# by coding it display only one record.

i send a multiple values from listbox but display only one in Crystal Report.

i use :

for(int i=0;i<code.length;i++)>
                {
                    strSelection=strSelection+"''"+code[i]+"''"+",";
                }

                strSelection = strSelection.Substring(0, strSelection.Length - 1);
                string str = "select crbal*-1 as crbal,glname, glcode,contprsn, refby, glphone1, glcity, glphone2, email, crlimit, restorddueamt  from glmast WHERE drgroup=''A3402'' and crbal<>0 and glcode in(" + strSelection + ")";
                SqlDataAdapter ad = new SqlDataAdapter(str, con2);
                DataSet ds = new DataSet();

                ad.Fill(ds);

                path = Server.MapPath("Debtors_Total_Outstanding_Report.Rpt");
                cr = new ReportDocument();
                cr.Load(path);
                
                cr.SetDataSource(ds.Tables[0]);
              
                cr.SetParameterValue(0,ds.Tables[0].Rows[0][1].ToString());
                cr.SetParameterValue(1,company_name);
                cr.SetParameterValue(2, database_name);
                       
                CrystalReportViewer1.ReportSource = cr;
                CrystalReportViewer1.DataBind();




请帮我...

我的水晶报表"中有三个参数.

谢谢和问候....
Mitesh




please help me...

There are Three parameters in My Crystal Report.

Thanks and Regards....
Mitesh

推荐答案

请检查您的.rpt文件.
是否存在任何分组.因为您的报告打印了错误的数据.
Please check your .rpt file.
Is there any grouping existing or not. Because your report print wrong data.


如果要多次打印相同的值,则将datatable设置为source.然后在详细部分中打印这些字段.
水晶报表不支持动态参数.在Crystal报表中添加参数后,必须通过该参数.
在您的情况下,您想使用循环进行设置.您的数据表包含许多记录,因此您必须将其设置为源并在详细部分中进行打印.
否则,请给我您要打印的确切定义.所以我可以帮助您..
If You want to print multiple time same value then set datatable to source. And then print those field in detail section.
Crystal report not support dynamically parameter. Once you add parameter in crystal report that parameter you have to pass.
In your case you want to set it using loop. your datatable contain many record so you have to set it as source and print it in detail section.
Other wise give me your exact definition what you want to print. So i can help you..


这篇关于通过编码设置参数时,晶体报告显示最后一条记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆