Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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:

C#
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
Posted
Updated 9-Mar-12 4:17am
v2
Comments
walterhevedeich 8-Mar-12 22:19pm    
Sorry but we don't know the problem. You know the problem and if you can tell it to us, we can probably help. At least describe the expected output and error(s) if there's any.
FM7 9-Mar-12 10:14am    
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.

1 solution

 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900