如何使用带Sql Server的asp.net c#修改查询以获取每月考勤报告
我在SQLServer中有一个表,如下所示如何使用带Sql Server的asp.net c#修改查询以获取每月考勤报告,c#,sql,asp.net,datatables,C#,Sql,Asp.net,Datatables,我在SQLServer中有一个表,如下所示 rollno date atendence 1 05/27/2015 1 2 05/27/2015 0 3 05/27/2015 1 4 05/27/2015 1 1 04/27/2015 1 2 04/27/2015 1 3 04/27/2015
rollno date atendence
1 05/27/2015 1
2 05/27/2015 0
3 05/27/2015 1
4 05/27/2015 1
1 04/27/2015 1
2 04/27/2015 1
3 04/27/2015 1
4 04/27/2015 1
rollno atendence total percentage
1 2 2 100.00
2 1 2 50.00
3 2 2 100.00
4 2 2 100.00
_____________________________________________________________________
April may
______________________________________________________________________
rollno atendence total percentage atendence total percentage
_________________________________________________________________________
1 1 1 100.00 1 1 100.00
2 1 1 100.00 0 1 0.00
3 1 1 100.00 1 1 100.00
________________________________________________________________________
在上表中,附件第1列表示存在,第0列表示不存在
当我试图显示月度独立报告时,我能够计算总报告,而不是月度报告
我使用了以下查询
select rollno, sum(case when satendence.atendence != 0 then satendence.atendence else 0 end)
as atendence, (select count(day) from atenmaster) as total,
(convert (money, 100.0 * sum(case when satendence.atendence != 0 then satendence.atendence else 0 end) / (select count(day) from atenmaster), 1)) as percentage
from satendence
group by rollno
上述查询的输出如下所示
rollno date atendence
1 05/27/2015 1
2 05/27/2015 0
3 05/27/2015 1
4 05/27/2015 1
1 04/27/2015 1
2 04/27/2015 1
3 04/27/2015 1
4 04/27/2015 1
rollno atendence total percentage
1 2 2 100.00
2 1 2 50.00
3 2 2 100.00
4 2 2 100.00
_____________________________________________________________________
April may
______________________________________________________________________
rollno atendence total percentage atendence total percentage
_________________________________________________________________________
1 1 1 100.00 1 1 100.00
2 1 1 100.00 0 1 0.00
3 1 1 100.00 1 1 100.00
________________________________________________________________________
但我想显示如下
rollno date atendence
1 05/27/2015 1
2 05/27/2015 0
3 05/27/2015 1
4 05/27/2015 1
1 04/27/2015 1
2 04/27/2015 1
3 04/27/2015 1
4 04/27/2015 1
rollno atendence total percentage
1 2 2 100.00
2 1 2 50.00
3 2 2 100.00
4 2 2 100.00
_____________________________________________________________________
April may
______________________________________________________________________
rollno atendence total percentage atendence total percentage
_________________________________________________________________________
1 1 1 100.00 1 1 100.00
2 1 1 100.00 0 1 0.00
3 1 1 100.00 1 1 100.00
________________________________________________________________________
使用asp.net网格视图。首先确认是否将
iTextSharp
DLL添加到项目中的DLL
引用中,然后确保在代码中包含正确的名称空间。例如:
using iTextSharp.text;
using iTextSharp.text.pdf;
只需确保所有这些都在项目和代码中正确引用即可。如果没有,则需要为iTextSharp
添加引用
希望这能有所帮助。请确保网站所在的web服务器上有iTextSharp 将iTextSharp.dll移动或复制到web服务器中的GAC-c:\windows\assembly-中
你公布你的申请了吗?查看错误消息的内容。将iTextSharp.dll放入Web服务器的bin文件夹。将其移到GAC中不是一个好方法,因为并非所有应用程序都需要此DLL。@Daniel Groh。。。我已经将我的dll文件移到了bin文件夹中,并且它在我的本地服务器中运行良好…当我将其上载到网站时,我遇到了此错误…@user3567786请我建议您准确解释您的场景。我想这对我们来说并不清楚。你的帖子没有提到任何上传功能,也许这作为回答太短了,但@DanielGroh是对的。这个问题的答案和他在回答中描述的一样微不足道。否则我不知道怎么回答。您应该以与部署任何其他第三方DLL相同的方式在web服务器上部署iTextSharp。