Skip to Content
0
Former Member
Dec 15, 2011 at 11:52 PM

Entity framework - Crystal report display columns from different tables

38 Views

i have a project with VB.net 2010 / Entity framework 4. I have 2 tables :

Table1                   Table2     
id1                      id2     
name                    value     
city                     date     
                         id1

i want to display on report : value , date , Name

i can make the query to get records that i need to display on report ,

with report wizard , i have created the crystal report ( CrystalReport1.rpt ) with fields from both 2 tables : value date name.

Now , this is my code :

Dim report As New ReportDocument
 
report.Load("c:Crystalreport1.rpt" )
 
Dim context As New myEntities
 
Dim query = From t1 In context.table2 where ....conditions
 
            Select t1.value , t1.date , t1.table1.nameu3000
 
report.SetDataSource(query.ToList)
 
Form1.CrystalReportViewer1.ReportSource = report

when the report is open , the columns value and date are filled with correct values , but the column name is empty.

What can i do ?

thank you.