Click here to Skip to main content
15,905,612 members
Home / Discussions / C#
   

C#

 
GeneralRe: Registry Redirection Pin
Richard Andrew x648-May-21 11:47
professionalRichard Andrew x648-May-21 11:47 
GeneralRe: Registry Redirection Pin
Dave Kreskowiak8-May-21 14:05
mveDave Kreskowiak8-May-21 14:05 
QuestionHow to speed up datatable updation for high volume of data Pin
Mou_kol6-May-21 0:01
Mou_kol6-May-21 0:01 
AnswerRe: How to speed up datatable updation for high volume of data Pin
OriginalGriff6-May-21 0:52
mveOriginalGriff6-May-21 0:52 
AnswerRe: How to speed up datatable updation for high volume of data Pin
Gerry Schmitz6-May-21 7:33
mveGerry Schmitz6-May-21 7:33 
GeneralRe: How to speed up datatable updation for high volume of data Pin
Mou_kol6-May-21 22:49
Mou_kol6-May-21 22:49 
GeneralRe: How to speed up datatable updation for high volume of data Pin
Gerry Schmitz7-May-21 9:57
mveGerry Schmitz7-May-21 9:57 
GeneralRe: How to speed up datatable updation for high volume of data Pin
#realJSOP11-May-21 1:01
professional#realJSOP11-May-21 1:01 
AnswerRe: How to speed up datatable updation for high volume of data Pin
Eddy Vluggen6-May-21 9:15
professionalEddy Vluggen6-May-21 9:15 
GeneralRe: How to speed up datatable updation for high volume of data Pin
Mou_kol6-May-21 22:50
Mou_kol6-May-21 22:50 
GeneralRe: How to speed up datatable updation for high volume of data Pin
Eddy Vluggen7-May-21 2:32
professionalEddy Vluggen7-May-21 2:32 
AnswerRe: How to speed up datatable updation for high volume of data Pin
Richard MacCutchan7-May-21 0:01
mveRichard MacCutchan7-May-21 0:01 
QuestionHow to retrieve SQL Server CE toolbox in Visual Studio 2019? Pin
Alex Dunlop5-May-21 6:51
Alex Dunlop5-May-21 6:51 
AnswerRe: How to retrieve SQL Server CE toolbox in Visual Studio 2019? Pin
Gerry Schmitz5-May-21 8:24
mveGerry Schmitz5-May-21 8:24 
QuestionGet the value from a checklistbox Pin
Luis M. Rojas5-May-21 6:35
Luis M. Rojas5-May-21 6:35 
AnswerRe: Get the value from a checklistbox Pin
Gerry Schmitz5-May-21 8:19
mveGerry Schmitz5-May-21 8:19 
GeneralRe: Get the value from a checklistbox Pin
Luis M. Rojas5-May-21 11:01
Luis M. Rojas5-May-21 11:01 
GeneralRe: Get the value from a checklistbox Pin
Gerry Schmitz5-May-21 11:18
mveGerry Schmitz5-May-21 11:18 
GeneralRe: Get the value from a checklistbox Pin
Richard MacCutchan5-May-21 21:16
mveRichard MacCutchan5-May-21 21:16 
AnswerRe: Get the value from a checklistbox Pin
Alan N6-May-21 4:06
Alan N6-May-21 4:06 
GeneralRe: Get the value from a checklistbox Pin
Luis M. Rojas7-May-21 3:30
Luis M. Rojas7-May-21 3:30 
QuestionHow convert SQL Server Pivot functionality in C# uisng LINQ Pin
Mou_kol3-May-21 5:45
Mou_kol3-May-21 5:45 
I am using SQL Server Pivot which works fine. Here is sample data below which transpose by SQL server pivot function. this is sample data which convert to pivot by SQL server.

+------------+--------------+-----------+--------------+--------+-------------+--------------------+----------+
     | RowNumber  |   Section    | LineItem  | DisplayInCSM | Broker | BrokerName  | ItemValue_NoFormat |  Period  |
     +------------+--------------+-----------+--------------+--------+-------------+--------------------+----------+
     |          1 | Operational  | NG Sales  | NGL          | CR     | Credit Suse |                200 | 2010 FYA |
     |          2 | Operational  | NG Sales  | NGL          | GR     | Max 1       |                300 | 2010 FYA |
     |          3 | Operational  | NG Sales  | NGL          | PX     | Morgan      |                100 | 2010 FYA |
     |          4 | Operational  | NG Sales  | NGL          | WB     | Wells Fargo |                500 | 2010 FYA |
     +------------+--------------+-----------+--------------+--------+-------------+--------------------+----------+



This is dynamic sql i used in sql server to represent data in pivot format. here it is.
C#
SET @SQL='SELECT *                                      
     FROM                                                                              
     (                      
       SELECT RowNumber,CAST(ISNULL(EarningID,0) AS INT) EarningID,    
       Section,    
       LineItem,    
       DisplayInCSM,     
       Type,     
       Broker,    
       BrokerName,     
       ItemValue_NoFormat,     
       TRIM(ISNULL(Period,'''')) Period,hierarchy,                
       from #tmpData1 WHERE TYPE<>''SHEET''                                                                      
     ) t                                                                              
     PIVOT                                                                              
     (                                                                              
      MAX(ItemValue_NoFormat)                                                                              
      FOR Broker IN ([5W], [8K], [CL], [DA], [EQ], [FA], [GS], [HM], [HQ], [JY], [KW], [ML], [MS], [MV], [SL], [UA],[WB])                                                                              
     ) AS P                                                                              
     order by hierarchy,PeriodOrder



Now due to some problem i have to use C# to pivot data which is stored in list. suppose my first sample stored in list now how can i pivot that data by c# LINQ.

i saw these post Is it possible to Pivot data using LINQ?
https://stackoverflow.com/questions/167304/is-it-possible-to-pivot-data-using-linq/6282689#6282689

Pivot data using LINQ
https://stackoverflow.com/questions/963491/pivot-data-using-linq

but still not clear to me how to write the code for my scenario which display broker name horizontally. so please some one give me some hint which help me to start the coding part as a result i can show my data in pivot format where broker name will be shown horizontally. thanks
QuestionRe: How convert SQL Server Pivot functionality in C# uisng LINQ Pin
Eddy Vluggen3-May-21 6:10
professionalEddy Vluggen3-May-21 6:10 
AnswerRe: How convert SQL Server Pivot functionality in C# uisng LINQ Pin
Mou_kol3-May-21 6:50
Mou_kol3-May-21 6:50 
GeneralRe: How convert SQL Server Pivot functionality in C# uisng LINQ Pin
Eddy Vluggen3-May-21 6:57
professionalEddy Vluggen3-May-21 6:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.