himani895 says:
string
query =
" select td.agentid , ud.fullname as 'username', sm.ShiftType, sm.StartTime as 'shift in', "
+
"sm.EndTime as 'shift out',CAST(td.[Datetime] as time) as 'logged in', "
+
" cast(td.[Fld_Date_Time_End] as time) as 'log out' "
+
" from switch.dbo.timedistribution td "
+
" inner join common.dbo.Userdetails ud on td.agentid = ud.UserID "
+
"inner join common.dbo.User_Dailyshift uds on uds.userid = td.agentid "
+
"inner join common.dbo.shift_master sm on sm.shiftid = uds.shiftid and td.agentid = uds.userid "
+
"where month(td.[Datetime]) = "
+ ddl_MonthYear.SelectedItem.Value +
" and year(td.[Datetime]) = "
+ ddl_year.SelectedItem.Value +
" and td.agentid = "
+username;
Replace the above with the below code.
string query = " select td.agentid , ud.fullname as 'username', sm.ShiftType, sm.StartTime as 'shift in', " +
"sm.EndTime as 'shift out',CAST(td.[Datetime] as time) as 'logged in', " +
" cast(td.[Fld_Date_Time_End] as time) as 'log out' " + " from switch.dbo.timedistribution td " +
" inner join common.dbo.Userdetails ud on td.agentid = ud.UserID " +
"inner join common.dbo.User_Dailyshift uds on uds.userid = td.agentid " +
"inner join common.dbo.shift_master sm on sm.shiftid = uds.shiftid and td.agentid = uds.userid " +
"where month(td.[Datetime]) = " + ddl_MonthYear.SelectedItem.Value +
" and year(td.[Datetime]) = " + ddl_year.SelectedItem.Value +
" and CONVERT(VARCHAR(100),td.agentid) = " +username;