Skip to content
Advertisement

How to Display student attendance in gridview using SQL and Gridview

I am using SQL Server 2012 and VS 2012 C# I have designed database table Roll_No, Attend_Date, Attend_Status while storing data i store like this

But I have to show in grid-view like this

Can you Help me please… How can I achieve this result..

Advertisement

Answer

You can do this by listing each date as column name while doing PIVOT or use dynamic SQL to generate column list and then apply PIVOT.

PIVOT is used to change row data to columns.

OUTPUT

Now you can bind this resultset to your GridView

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement