Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
This is a attendance project.

I want to store data like these


Table has 4 field srno , name, date, attendance


srno name 1 2 3 4 5 6 7 8 9 10 11 12.... to 31

1 abcd P P A P A P
2 cccc A P A P P P
3 dddd P P P P A P

The problem is that, how can I search data from table like that?
I want these data month wise in <code>DataGridView</code>.
Posted
Updated 28-Dec-10 1:52am
v2

how can i search data from table like that, I want these data month wise in datagridview.
By preparing a proper Query.
If needed, you can use stored procedure, table valued function in order to get the desired format.
 
Share this answer
 
Hi,

My suggestion is to design the table like this

SrlNo Date StudentID AttFlag
1 28/12/2010 1 P
1 28/12/2010 2 A
 
Share this answer
 
Comments
myu981987 10-Mar-12 15:05pm    
i have to do the same but data of student table n attendance table are shown together but i cant store attflag value on attendance table please help me out
Make your Table structure like this



S.NoNameYearMonthD1D2D3D4D5D6D7D8D9D10D11D12D13D14D15D16D17D18D19D20D21D22D23D24D25D26D27D28D29D30D31
1CG201012PPPPPPPPPAPPPPAAAAAPPPAPPPPPPPP
2JSOP201012PPPPPPPPPAPPPPAAAAAPPPAPPPPPPPP
3Pete201012PPPPPPPPPAPPPPAAAAAPPPAPPPPPPPP
4Nish201012PPPPPPPPPAPPPPAAAAAPPPAPPPPPPPP
5Luc201012PPPPPPPPPAPPPPAAAAAPPPAPPPPPPPP
6Sacha201012PPPPPPPPPAPPPPAAAAAPPPAPPPPPPPP
7Dave201012PPPPPPPPPAPPPPAAAAAPPPAPPPPPPPP
8DD201012PPPPPPPPPAPPPPAAAAAPPPAPPPPPPPP
9Marc201012PPPPPPPPPAPPPPAAAAAPPPAPPPPPPPP
10Chris201012PPPPPPPPPAPPPPAAAAAPPPAPPPPPPPP


Now you can bring the things in front end by using Gridview control with templates.

Dynamically Templated GridView with Edit, Delete and Insert Options[^]

You can use checkbox control in Grid view Item template for mark the the person whether Present or absent. Also Make S.No, Name, columns read only because you don't need to enter things in those fields. Also you can put the year & month in dropdownlist in Item template. Anyway Go ahead.

BTW check the things like Feb month total days(28 or 29 based on leap year).
 
Share this answer
 
v2

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