Click here to Skip to main content
15,896,453 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello!
I have code:
CSS
var listOfUsers = from a in context.CMSPI_CODICIACCESSO
                              join b in context.CMSPI_ANAGRAFICAINFOBASE
                              on a.IDANAGRAFICA equals b.IDANAGRAFICA
                              select b;



But this code returns only fields from table a. I need return all fields from every tables. How it make? Thank you
Posted

1 solution

Try this:
C#
var listOfUsers = (from x in context.CMSPI_CODICIACCESSO
         join u in context.CMSPI_ANAGRAFICAINFOBASE on x.IDANAGRAFICA equals u.IDANAGRAFICA
    select new {
          RowA = x, RowB = u
    });
DataTable result = new DataTable();
foreach (var x in listOfUsers)
{
     result.Rows.Add(x.RowA , x.RowB);
}




--Amit
 
Share this answer
 
v2
Comments
[no name] 8-Apr-13 7:58am    
So it is good solutions. But how i can display it at VIEW? at emp there is two objects:
RowA = {CMSPI.Models.CMSPI_CODICIACCESSO}
RowB = {CMSPI.Models.CMSPI_ANAGRAFICAINFOBASE}
and at each there are fields that i must show
_Amy 8-Apr-13 8:05am    
Marked as Answer and Again Undo. Why?
Anyways, see my updated solution with a Resultant DataTable. Now you can do anything with the result DataTable.
[no name] 8-Apr-13 8:13am    
i can not use DataTable. I must show it at table HTML.
_Amy 8-Apr-13 8:15am    
Yes, then loop through the DataTable and show the content in HTML Table. There should not be any problem in that.
[no name] 8-Apr-13 8:31am    
Can you show me example. I dont understand

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