Click here to Skip to main content
15,890,982 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi i have two data tables have to combine two data table into one data table and need to use the combined data table into report source for crystal report.

i merged two data table but in the crystal report it displaying more no pages not showing combined data table values into single page.
Posted

Then need to see your code. Do you use datatable.merge to combine to 2 datatables? Basically it would like:
C#
DataTable dt1 = new DataTable();
DataTable dt2 = new DataTable();
DataTable dt3 = dt1.Copy();
dt3.Merge(dt2);

Some good alternatives may be:
DataTable.LoadDataRow Method [^]
DataTable.ImportRow Method [^]
 
Share this answer
 
v3
Hi you can use DataTable.Merge Method to combine the two data table values. have look of the link

http://msdn.microsoft.com/en-us/library/fk68ew7b%28v=vs.110%29.aspx[^]

http://forums.asp.net/t/1416974.aspx[^]

OR


you may go for sql view. just make sql view and then use that view to populate the data on report. This improve performance and you will be able to get the record in a single datatable.
 
Share this answer
 
v2
Rather than adding two tables you can simply do it by creating a view in database.then crystal report will be much more easier.

example:

table 1:student(sid,sname,scid)
table 2:course(cid,cname)

student scid is referenced from course cid.you can create view,

create view studentcourse
as select s.sid,s.sname,s.scid,c.cname
from student s,course c

now you can access view as a single data set but there are all the columns you need.
this is really easiest way.i do it all time.
 
Share this answer
 

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