SQL中C#的Crystal报表记录选择公式 [英] Crystal report record selection formula in C# from SQL
问题描述
我是Crystal Report的新手,我通过以下方法成功创建了Crystal报表
1)创建Crystal Report为空白
2)进入数据库专家并使用OLE DB(ADO)创建数据库
3)在OLE DB(ADO)中我只是将表添加到数据库并在Crystal Report上显示它
4)然后我创建了一个Win表单,我使用了Crystal Report Viewer
5)然后我在Crystal Report Viewer选项卡上使用以下代码来调用Crystal报表
代码:
var cryRpt = new ReportDocument();
cryRpt.Load( @ C:\ Users \Ahsan \Desktop \ PROJECT INVENTORY SOFTWARE \ InventorySoftware \InventorySoftware \Crystal Reports \CrystalReport2.rpt);
crystalReportViewer1.ReportSource = cryRpt;
crystalReportViewer1.Refresh();
现在做什么,它去桌上取表完整的数据,就好像我有500条记录那么它将加载所有500条记录,这就是我不想做的事情。我真正需要做的是获取特定发票的数据否,我无法以任何方式执行此操作。
i希望它仅获取数据在运行时写在表单(文本框)上的发票编号,以及我想要获取数据的查询是使用联接构建的。
i am从过去3个小时开始坚持做谷歌但是无法做到这一点。
请亲爱的伙伴帮助我。我将非常感激
谢谢。
在您的查询中使用limit sql关键字或添加到哪里condtion
i am new in Crystal Report, I've Created a Crystal Report Successfully By following Methods
1)Created Crystal Report As Blank
2)get into Database Expert and create Database using OLE DB(ADO)
3)in OLE DB(ADO) i simply add tables into the Database and showed it on Crystal Report
4)Then i created a Win form on which i used Crystal Report Viewer
5)then i use following Code on Crystal Report Viewer Tab to Call the Crystal Report
Code:
var cryRpt = new ReportDocument();
cryRpt.Load(@"C:\Users\Ahsan\Desktop\PROJECT INVENTORY SOFTWARE\InventorySoftware\InventorySoftware\Crystal Reports\CrystalReport2.rpt");
crystalReportViewer1.ReportSource = cryRpt;
crystalReportViewer1.Refresh();
Now what does it do, it go to table fetch complete Data on the table, like if i have 500 Records then it will load all the 500 Records, and that's what i don't want to do. what i actually need to do is to fetch data of a specific invoice no and i am not able to do this in any way.
i want it to fetch data for only that invoice number which is written on the form (a text box) at run time, and the query through which i want to fetch data is build using Joins.
i am stuck and doing Google from past 3 hours but not able to do it.
Please dear fellows Help me out. i will be very grateful
Thanks.
use limit sql keyword in your query or add where condtion
这篇关于SQL中C#的Crystal报表记录选择公式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!