Quantcast
Channel: Pivot table in c# entity framework
Viewing all articles
Browse latest Browse all 6

Pivot table in c# entity framework

$
0
0

ISO Code

description

Year

value

CAD

Canadian Dollar

2009

1.3001

CAD

Canadian Dollar

2010

1.3001

CAD

Canadian Dollar

2011

0.0001

EUR

Euro

2009

1.0000

EUR

Euro

2010

1.0000

EUR

Euro

2011

0.0001

USD

US Dollar

2009

1.2300

USD

US Dollar

2010

1.2300

USD

US Dollar

2011

0.0001

Table 1

 

ISO Code

description

2009

2010

2011

CAD

Canadian Dollar

1.3001

1.3001

0.0001

EUR

Euro

1.0000

1.0000

0.0001

USD

US Dollar

1.2300

1.2300

0.0001

Table 2

How can table 1 be converted to table 2 using linq in c#, provided that the number of years is dynamic ( it’s not fixed to 2009,2010, 2011, values 2012,2013 and so on can be added afterwards)

the classes are as following

 

class Currency

       {

           public string ISO Code { get; set; }

           public string Description { get; set; }

         }

class Rate

{       

   public string ISO Code { get; set; }

   public int Year { get; set; }

   public inr Value { get; set; }

}

 

In the end I have to bind the results to a gridview. Can someone please help

 


Viewing all articles
Browse latest Browse all 6

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>