2015-04-18 30 views
0

我在SQL Server中的表像如在atendence第1列上表如下如何修改查詢中使用asp.net C#與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 

表示現在和0表示不存在

當我試圖顯示一個月明智atendence報告,我能夠計算總報告沒有月度明智..

我用下面的查詢

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 

,但我想作爲使用asp.net網格視圖如下

_____________________________________________________________________ 
       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 
________________________________________________________________________ 

顯示它....請幫助修改查詢

在此先感謝

回答

0

首先確認是否iTextSharp DLL我將其添加到項目中的dll引用中,然後確保在代碼中包含正確的名稱空間。一個examlpe將是:

using iTextSharp.text; 
using iTextSharp.text.pdf; 

只要確保所有這些在您的項目以及代碼中正確引用。如果不是,則需要爲iTextSharp添加參考。

希望這會有所幫助。

+0

幽靈....我已經檢查,仍然面臨同樣的問題.... – Ramya

0

確保iTextSharp在託管網站的Web服務器中可用。

移動或iTextSharp.dll複製到GAC - C:\ WINDOWS \總成 - 在你的Web服務器

0

你有沒有發表您的應用程序?看看有什麼錯誤消息說。將iTextSharp.dll放入Web服務器的bin文件夾中。將其移入GAC不是一種好方法,因爲並非所有應用程序都需要此DLL。

+0

這可能是一個評論,而不是一個正式的答案。 –

+0

@Daniel Groh ...已經將我的dll文件移動到bin文件夾中,並且它完全在我的本地服務器中工作...當我將該錯誤上傳到網站時,我收到了此錯誤... – Ramya

+0

@JL。你是對的,我在這裏新來的。 – DAG