I want an attandance count for a month... [Resolved]

Posted by Jenniffer under C# on 4/6/2013 | Points: 10 | Views : 1451 | Status : [Member] | Replies : 3
I have tried a little bit...
Select COUNT(*) as Present from T_CAL_Attendance where Attendance_Type='P' and [Date] BETWEEN '" + FromDate + "' AND '" + ToDate + "' and Name='" + UName + "'

I have tested my code in SQL, i got the correct output but the same code i put in codebehind it retreving count with date....

Pls Help me if u know the answer.....

Thanks & Regards
JENI



Responses

Posted by: Jayakumars on: 4/6/2013 [Member] [MVP] Bronze | Points: 50

Up
0
Down

Resolved
hi
create new instance and use them

DataSet ds1 = new DataSet();

Mark as Answer if its helpful to you

Jenniffer, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jayakumars on: 4/6/2013 [Member] [MVP] Bronze | Points: 25

Up
0
Down
hi

try To Datatable and use select the Datatable.

Mark as Answer if its helpful to you

Jenniffer, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Pawansoftit on: 4/6/2013 [Member] Starter | Points: 25

Up
0
Down
Hai Jennifer,
Sometimes when you execute this statement from the front end applications, it will not give you the correct reults.
So try the below sql statement and check in both the SQL Server as well as running from the front end applications:
Select COUNT(*) as Present
from T_CAL_Attendance
where Attendance_Type='P'
and [Date] >= '" + FromDate + "'
AND [Date] <= '" + ToDate + "'
and Name='" + UName + "'
Also make sure that the format of the [Date] and FromDate and ToDate formats should be the same.
If they are not in the same format, you will not get the correct results. If they are not in the same format, make them in the code with the same formats.
Hope it will be helpful to you.

Regards,
Pawan Awasthi
pawansoftit@gmail.com
+91 8123489140(WhatsApp)

Jenniffer, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response