如何从Crystal报表中删除重复记录? [英] how to remove Duplicate records from Crystal report?

查看:94
本文介绍了如何从Crystal报表中删除重复记录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用两张桌子创建了一个水晶报告..

我的SQL查询是 - :

I created a crystal report with two tables..
My SQL query is -:

SELECT ct.custID, c.custName, c.custAdd, ct.custTranDate, ct.custTranType, ct.custPaidAmt, ct.custDueAmt, c.custArea
FROM custTransaction AS ct INNER JOIN custDetails AS c ON ct.custID = c.custID
WHERE ct.custTranDate BETWEEN #2/2/13# AND #3/2/13# and ct.custID='CUST-000002';



当我在访问中运行此查询时它工作正常..但当我运行此查询时OLEDB对象,并将数据集设置为水晶报告。水晶报告显示重复记录(它是custTransaction中特定custID的倍数。如果我在custTransaction表中输入custID =''CUST-000002'的3条记录,它在水晶报告中显示相同记录的3 * 3倍)。 br $>


我的C#代码是 - :


when i run this query in access it''s works fine.. but when i run this query with OLEDB object, and set dataset to crystal report. crystal report show duplicate records(it''s multiple of specific custID in custTransaction. if i entry 3 records of custID=''CUST-000002'' in custTransaction table,it show 3*3 times same records in crystal report).

My C# code is -:

private void button1_Click(object sender, EventArgs e)
        {
            OleDbDataAdapter adpt=new OleDbDataAdapter("SELECT ct.custID, c.custName, c.custAdd,ct.custTranDate,ct.custTranType,ct.custPaidAmt,ct.custDueAmt, c.custArea FROM custTransaction ct INNER JOIN custDetails c ON ct.custID = c.custID WHERE ct.custTranDate BETWEEN #"+MF.retOriginalDate(DTP1.Value.Date.ToShortDateString())+"# AND #"+MF.retOriginalDate(DTP2.Value.Date.ToShortDateString())+"# and ct.custID='"+textBox3.Text+"'",conn);
            DataSet ds = new DataSet();
            adpt.Fill(ds, "custTransaction");
            customerLaser CL = new customerLaser();//customerLaser is a Crystal Report            
            CL.SetDataSource(ds.Tables["custTransaction"]);                        
            customerLaser CL = new customerLaser();
            CL.SetDataSource(DC.dataSet.Tables["custTransaction"]);
            CL.SetDatabaseLogon("Admin", "");
            CL.Refresh();
            report_show RS = new report_show();
            RS.crystalReportViewer1.ReportSource = CL;
            RS.crystalReportViewer1.Refresh();
            RS.Show();
        }



我正在使用访问数据库....

如何避免水晶报告中的重复记录???

提前感谢...


I''m using access database....
how to avoid duplicate record in crystal report???
thanks in advance...

推荐答案

嗨!!! Jayanta





请使用此查询



Hi!!! Jayanta


use like this query

<pre lang="SQL">SELECT Customers.CompName, Customers.Add, Customers.City, Customers.ContactName, Customers.Phone
FROM Customers
WHERE (((Customers.CompName) In (SELECT [CompName] FROM [Customers] As Tmp GROUP BY [CompName],[Add],[City] HAVING
Count(*)>1 And [Add] = [Customers].[Add] And [City] = [Customers].[City])))
ORDER BY Customers.CompName, Customers.Add, Customers.City;







ref :: http:/ /office.microsoft.com/en-in/access-help/find-eliminate-or-hide-duplicate-records-in-access-HA001034558.aspx [ ^ ]


Hi
选中要避免重复输入的字段的抑制复选框
Hi Check the suppress check Box for the field you want to avoid Duplicated entry


这篇关于如何从Crystal报表中删除重复记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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