将命令文本发送到crystalreport的问题 [英] problem to send commandtext to crystalreport
本文介绍了将命令文本发送到crystalreport的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这里的代码:
cmd.commandtext = " + txtID.text + '";
da.selectcommand = cmd;
da.fill(dt);
form1 newform = 新 form1();
crystalreport1 cr = 新 crystalreport1();
cr.setdatasource(dt);
newform.crystalreportviewer1.reportsource = cr;
newform.show();
问题是:
查询在datagridview中起作用,但在crystalreport Viewer中不起作用.
当查询在一个表上时,一切正常,但对两个有关系的表不起作用.
感谢
解决方案
在以下示例中提供了有用的参考: ^ ]
hi
i use this code to execute a query and it works to show result in datagridview exactly right(3 records).but when i want to send it to crystalreportviewer it will show 30 rocords!!
i create crystalreport by using the wizard in 2010.
here thid code:
cmd.commandtext="select fname,lname,startDate,EndDate from personel,leave where personid=id and id='"+txtID.text+"'";
da.selectcommand=cmd;
da.fill(dt);
form1 newform=new form1();
crystalreport1 cr=new crystalreport1();
cr.setdatasource(dt);
newform.crystalreportviewer1.reportsource=cr;
newform.show();
problem is:
query works in datagridview,BUT no works in crystalreport viewer.
when query is on one table,everything is ok,BUT no works for 2 tables which have relationships.
thanks
解决方案
Useful reference is available with example at: http://csharp.net-informations.com/crystal-reports/csharp-crystal-reports-multiple-tables.htm[^]
这篇关于将命令文本发送到crystalreport的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文