Click here to Skip to main content
15,892,575 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,
I want to apply two datatable single report datasource please help me one datatable contrain Image and another datatable contain data from database
rpt.SetDataSource(dt1)
rpt.SetDataSource(dt)


using vb.net and crstal report


Thank You
Posted

Pass DataSet instead of DataTables
VB
DataSet ds = new DataSet();
ds.Tables.Add(dt1);
ds.Tables.Add(dt);
rpt.SetDataSource(ds);

And make sure the tables are same(both report tables & DataTable names). Using TableName Property[^] you could change the name.
FYI
C# Crystal Reports from multiple tables[^]
Creating Crystal Report with Multiple Tables in ASP.NET[^]
 
Share this answer
 
Comments
Member 10151142 22-Nov-14 2:38am    
Dim ds As New DataSet()
ds.Tables.Add(dt1)
ds.Tables.Add(dt)
rpt.SetDataSource(ds)

Very good solution working well
Make a view or in custom function or stored procedure in one of those two database. I prefer to make it in Master Database. Let say you make a stored procedure in (dt1) then generate a temporary table and load it with both database data. call that stored procedure from your crystal report only use
rpt.SetDataSource(dt1)

it will be faster in performance.
 
Share this answer
 
Hi,
You can go with two options. One by using "Typed DataSets" and Second is "Sub Report".

Typed datasets will take multiple datatables with relationship defined and based on which the report would get generated.

Using Crystal Reports in ASP.Net Making use of strongly typed datasets[^]

Sub report is another report by itself linked to the main report. you can have any number of sub report in single main report.
Create a Subreport in Crystal Reports [^]
Adding a Subreport to the Original Report[^]
Step by Step Creation of Crystal Report using its Features Group, Graph, Cross-Tab and Sub Report[^]
Crystal Reports and Subreports[^]

I recommend to go with subreports.

hope it helps.
 
Share this answer
 
VB
Dim ds As New DataSet()
ds.Tables.Add(dt1)
ds.Tables.Add(dt)
rpt.SetDataSource(ds)

This is working ...
 
Share this answer
 
i Solved my self....

Using Some Trick and solved it for temporary basis
 
Share this answer
 
didn't need to share any one need please reply
 
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