出勤项目 [英] attendance project
问题描述
这是一个出勤项目.
我想存储这样的数据
表格有4个字段srno,名称,日期,出勤率
srno名称1 2 3 4 5 6 7 8 9 10 11 12 ....到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
问题是,如何从这样的表中搜索数据?
我想在< code> DataGridView</code>中按月明智地使用这些数据.
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>.
推荐答案
我该如何从表中搜索数据,我想要这些数据月在datagridview中明智.
通过准备适当的 Query .
如果需要,可以使用存储过程,表值函数来获取所需的格式.
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.
我的建议是像这样设计桌子
SrlNo Date StudentID AttFlag
1 28/12/2010 1 P
1 28/12/2010 2 A
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
使表格结构像这样
Make your Table structure like this
S.No | 名称 | 年份 | 月 | D1 | D2 | D3 | D4 | D5 | D6 | D7 | D8 | D9 | D10 | D11 | D12 | D13 | D14 | D15 | D16 | D17 | D18 | D19 | D20 | D21 | D22 | D23 | D24 | D25 | D26 | D27 | D28 | D29 | D30 | D31 |
1 | CG | 2010 | 12 | P | P | P | P | P | P | P | P | P | A | P | P | P | P | A | A | A | A | A | P | P | P | A | P | P | P | P | P | P | P | P |
2 | JSOP | 2010 | 12 | P | P | P | P | P | P | P | P | P | A | P | P | P | P | A | A | A | A | A | P | P | P | A | P | P | P | P | P | P | P | P |
3 | Pete | 2010 | 12 | P | P | P | P | P | P | P | P | P | A | P | P | P | P | A | A | A | A | A | P | P | P | A | P | P | P | P | P | P | P | P |
4 | Nish | 2010 | 12 | P | P | P | P | P | P | P | P | P | A | P | P | P | P | A | A | A | A | A | P | P | P | A | P | P | P | P | P | P | P | P |
5 | Luc | 2010 | 12 | P | P | P | P | P | P | P | P | P | A | P | P | P | P | A | A | A | A | A | P | P | P | A | P | P | P | P | P | P | P | P |
6 | Sacha | 2010 | 12 | P | P | P | P | P | P | P | P | P | A | P | P | P | P | A | A | A | A | A | P | P | P | A | P | P | P | P | P | P | P | P |
7 | Dave | 2010 | 12 | P | P | P | P | P | P | P | P | P | A | P | P | P | P | A | A | A | A | A | P | P | P | A | P | P | P | P | P | P | P | P |
8 | DD | 2010 | 12 | P | P | P | P | P | P | P | P | P | A | P | P | P | P | A | A | A | A | A | P | P | P | A | P | P | P | P | P | P | P | P |
9 | Marc | 2010 | 12 | P | P | P | P | P | P | P | P | P | A | P | P | P | P | A | A | A | A | A | P | P | P | A | P | P | P | P | P | P | P | P |
10 | Chris | 2010 | 12 | P | P | P | P | P | P | P | P | P | A | P | P | P | P | A | A | A | A | A | P | P | P | A | P | P | P | P | P | P | P | P |
S.No | Name | Year | Month | D1 | D2 | D3 | D4 | D5 | D6 | D7 | D8 | D9 | D10 | D11 | D12 | D13 | D14 | D15 | D16 | D17 | D18 | D19 | D20 | D21 | D22 | D23 | D24 | D25 | D26 | D27 | D28 | D29 | D30 | D31 |
1 | CG | 2010 | 12 | P | P | P | P | P | P | P | P | P | A | P | P | P | P | A | A | A | A | A | P | P | P | A | P | P | P | P | P | P | P | P |
2 | JSOP | 2010 | 12 | P | P | P | P | P | P | P | P | P | A | P | P | P | P | A | A | A | A | A | P | P | P | A | P | P | P | P | P | P | P | P |
3 | Pete | 2010 | 12 | P | P | P | P | P | P | P | P | P | A | P | P | P | P | A | A | A | A | A | P | P | P | A | P | P | P | P | P | P | P | P |
4 | Nish | 2010 | 12 | P | P | P | P | P | P | P | P | P | A | P | P | P | P | A | A | A | A | A | P | P | P | A | P | P | P | P | P | P | P | P |
5 | Luc | 2010 | 12 | P | P | P | P | P | P | P | P | P | A | P | P | P | P | A | A | A | A | A | P | P | P | A | P | P | P | P | P | P | P | P |
6 | Sacha | 2010 | 12 | P | P | P | P | P | P | P | P | P | A | P | P | P | P | A | A | A | A | A | P | P | P | A | P | P | P | P | P | P | P | P |
7 | Dave | 2010 | 12 | P | P | P | P | P | P | P | P | P | A | P | P | P | P | A | A | A | A | A | P | P | P | A | P | P | P | P | P | P | P | P |
8 | DD | 2010 | 12 | P | P | P | P | P | P | P | P | P | A | P | P | P | P | A | A | A | A | A | P | P | P | A | P | P | P | P | P | P | P | P |
9 | Marc | 2010 | 12 | P | P | P | P | P | P | P | P | P | A | P | P | P | P | A | A | A | A | A | P | P | P | A | P | P | P | P | P | P | P | P |
10 | Chris | 2010 | 12 | P | P | P | P | P | P | P | P | P | A | P | P | P | P | A | A | A | A | A | P | P | P | A | P | P | P | P | P | P | P | P |
现在,您可以通过使用带有模板的Gridview控件将这些东西放在前端.
具有编辑,删除和插入选项的动态模板化GridView [ ^ ]
您可以在网格"视图项目"模板中使用复选框控件,以将该人标记为在场"或不在场".另外,将S.No,Name,Name列设为只读,因为您无需在这些字段中输入内容.您也可以输入年份&项目模板的下拉列表中的月份.无论如何,请继续.
BTW检查诸如2月的总天数(基于leap年的28或29)之类的内容.
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).
这篇关于出勤项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!