Jump to content

Record Count returning negative value (-1) issue


walataza

Recommended Posts

Good day, i have an asp classic application.Its actually an eOffice system, but when i try to retrieve the number of people that are present,absent and on-leave, it returns -128426d760f.gifbelow is my source code, and attached above is the link to the image of how it looks, will really appreciate any help given...regards

<!--#include file="utils.asp"--><!--#include file="Js.asp"--><%dim rst,sqlsql="SELECT St_ID,  st_abbr, st_name, st_type_id, st_parent_id FROM e_structure WHERE (st_parent_id =0)" 'set rst1= objVO.OpenRecordSet(cstr(sql)) st_code,Set rst1= eOfficeDsn.Execute(sql)If rst1.eof then	Response.Write"sorry no reord found"	end if  %><table width="100%" border="0" cellpadding="2" cellspacing="2">  <tr> 	<td class="SubLevelText"><div align="center"></div></td>	<td class="SubLevelText"><div align="center"></div></td>	<td width="13%" class="SubLevelText"> <div align="left">Messages</div></td>	<td width="15%" class="SubLevelText"> <div align="left">Message Center</div></td>	<td width="16%" class="SubLevelText">Core Functions</td>	<td width="5%" class="SubLevelText"><div align="center"><img src="images/greebbanda16x16.gif" width="13" height="15"></div></td>	<td width="4%" class="SubLevelText"><div align="center"><img src="images/redbanda16x16.gif" width="13" height="16"></div></td>	<td width="4%" class="SubLevelText"><div align="center"><img src="images/graybanda16x16.gif" width="13" height="15"></div></td>  </tr>  <% while not rst1.EOF 		'REM line below is geting childs of structure id.if structure id is last chid then if condition will return that child		getnodetree(rst1.fields("st_id"))		stid=glbNodeList		'REM This code is counting Red email and showing it in main page index.htm		if stid="" then			SQL="SELECT Fromid from ivo_readmail WHERE [To] = "& Session("EmpId") &"  and To_St_ID =" & rst1.fields("st_id") & ""		else			SQL="SELECT Fromid from ivo_readmail WHERE [To] = "& Session("EmpId") &"  and To_St_ID in(" & stid & ")"			glbNodeList=""		end if		'set rst=objvo.openrecordset(cstr(sql),3)		Set rst= eOfficeDsn.Execute(sql)				Readmails=rst.recordcount 		rst.close		set rst= nothing		'REM this code is counting total emails		if stid="" then			SQL="SELECT Fromid from ivo_readmail WHERE [To] ="& Session("EmpId") &" and To_St_ID ="& rst1.fields("st_id")&""		else 			SQL="SELECT Fromid from ivo_readmail WHERE [To] ="& Session("EmpId") &" and To_St_ID in(" & stid & ")"			glbNodeList=""		end if		'set rst=objvo.openrecordset(cstr(sql),3)		Set rst= eOfficeDsn.Execute(sql)		totalmails=rst.recordcount 		rst.close		set rst= nothing ' end of counting total emails		'REM This code is counting employees those are present absent and on leave, and showing it in main page index.htm		if stid="" then			SQL="SELECT Attandance FROM ivo_attandance where st_id="& rst1.fields("st_id") & " and Attandance ='P' and convert(varchar,datetime,101)= convert(varchar,GETDATE(),101)"			else			SQL="SELECT Attandance FROM ivo_attandance where st_id in("& stid &") and Attandance ='P' and convert(varchar,datetime,101)= convert(varchar,GETDATE(),101)"			glbNodeList=""		end if 		'set rst=objvo.openrecordset(cstr(sql),3)		Set rst= eOfficeDsn.Execute(sql)		Present=rst.recordcount 		rst.close		set rst= nothing 'end of counting total present employees		REM code below is counting absent employees 		if stid="" then			SQL="SELECT Attandance FROM ivo_attandance where st_id="& rst1.fields("st_id")& " and Attandance ='A' and convert(varchar,datetime,101)= convert(varchar,GETDATE(),101)"			else			SQL="SELECT Attandance FROM ivo_attandance where st_id in("& stid & ") and Attandance ='A' and convert(varchar,datetime,101)= convert(varchar,GETDATE(),101)"			glbNodeList=""		end if		'set rst=objvo.openrecordset(cstr(sql),3)		Set rst= eOfficeDsn.Execute(sql)		Absent=rst.recordcount 		rst.close		set rst= nothing ' End of counting absent employess		REM following is counting Employee on leave		if stid ="" then			SQL="SELECT Attandance FROM ivo_attandance where st_id="& rst1.fields("st_id")& " and Attandance ='L' and convert(varchar,datetime,101)= convert(varchar,GETDATE(),101)"		else			SQL="SELECT Attandance FROM ivo_attandance where st_id in("& stid & ") and Attandance ='L' and convert(varchar,datetime,101)= convert(varchar,GETDATE(),101) "			glbNodeList=""		end if		'set rst=objvo.openrecordset(cstr(sql),3)		Set rst= eOfficeDsn.Execute(sql)		Leave=rst.recordcount 		rst.close		set rst= nothing ' End of counting employee on leave	%>  <tr> 	<td class="SubLevelText" width="7%"> <img border="0" src="../eOffice/images/inbox16x16.gif" width="16" height="16"><a class="home" target="_blank" href="../eOffice/Messaging/LearningArchitecture.asp"> 	  </a> </td>	<td  > <a class="yellowntext"target='_blank' href="Messaging/nodedetail.asp?st_id=<%=rst1.Fields("st_id")%>"><%=rst1.Fields("st_name")%></a></td>	<td  class="SubLevelText">  (<%=totalmails%>/<%=Readmails%>)</td>	<td align="right" nowrap class="yellowntext"><div align="center"><a target="_blank" href="Messaging/mail.asp?box=mailbox&st_id=<%=rst1.fields("st_id")%>"><img border="0" src="../eOffice/images/MessagingCenter.gif" width="16" height="16"></a></div></td>	<td align="right"><div align="center"><a href="#"><img border="0" src="../eOffice/images/reportsicon.gif" width="16" height="16"></a></div><div align="left"></div></td>	<%'REM code below 3 lines is attandance report for Present absent and on leave employees%>	<td  class="yellowntext"><div align="center"><a class="yellowtext" HREF="java script:popupwide('messaging/Reports/Attandancereport.asp?stid=<%=rst1.fields("st_id")%>&action=P')"><%=Present%></a></div></td>	<td  class="yellowntext"><div align="center"><a class="yellowtext" HREF="java script:popupwide('messaging/Reports/Attandancereport.asp?stid=<%=rst1.fields("st_id")%>&action=A')"><%=Absent%></a></div></td>	<td  class="yellowntext"><div align="left"><a class="yellowtext" HREF="java script:popupwide('messaging/Reports/Attandancereport.asp?stid=<%=rst1.fields("st_id")%>&action=L')"><%=Leave%></a></div></td>  </tr>  <% 	  rst1.MoveNextwendrst1.closeset rst1 = nothing  %>  <tr> 	<td colspan="7" class="SubLevelText"><div align="right"><span class="yellowtext">        Legends:</span> 		Present =<img src="images/greebbanda16x16.gif" width="13" height="15"> 		Absent =<img src="images/redbanda16x16.gif" width="13" height="16"> Leave 		=<img src="images/graybanda16x16.gif" width="13" height="15"></div></td>  </tr></table>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...