![](/img/trans.png)
[英]How to use a parameter for a SQL Server query that is part of the query itself using SqlDataReader in C# asp.net
[英]how to modify the query to get monthly attendence report using asp.net c# with Sql Server
我在sql server中有一個表,如下所示
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
上表中的出席者列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 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。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.