Link to home
Start Free TrialLog in
Avatar of Stacie
StacieFlag for United States of America

asked on

Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.

I get the following error bellow when I run this source code. I'm at a loss on what is the issue. This error when you do a POST when you submit for an insert.

Error:
ADODB.Field error '800a0bcd'
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
/LDA/Role_Assign_1.asp, line 231

Application URL: /LDA/Role_Assign_1.asp?UID=21&PCID=902600&CID=&ADD=Y

Code Base:

<%@ Language=VBScript %>

<%Response.Buffer =true%>

<%Response.Expires=0%>
<html>
<head>

<meta NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">


<link rel="stylesheet" type="text/css" href="css/master.css">
    <link rel="stylesheet" type="text/css" href="css/globalNav.css">
    <script language="JavaScript" type="text/javascript" src="js/global.js"></script>
    <script language="JavaScript" type="text/javascript" src="js/globalNav.js"></script>

<script language="javascript">
// Set these to true to enable debugging or tracing

    function change_form_action(targetpage) {
    document.form1.action = targetpage;
    document.form1.submit();
}
function change_action(targetpage) {
document.form1.action = targetpage;
}


function popit1a(targetpage, UID, PCID, CID)  {
  //  var winpops = window.open("RMK_Dept_Review.asp?rekn=" + rekn, "",  "toolbar=no,width=400,height=400,resizable=no,top=200,left=100");
    window.location="http://apps.tweddle.com/LDA/" + targetpage + "UID=" + rekn + UID + "&PCID=" +  PCID + "&CID=" + CID;
 //  alert("test");
        } 

</script>
</head>

<!--#include file="includes/topNav1.inc"-->
<!--#include file="includes/DB_Connect.asp"-->
<body onload="init();">
<%UID=Request.QueryString("UID")
ADD=Request.QueryString("ADD")
PID=REquest.QueryString("PID")
    IsAdmin=Session("IsAdmin")
    CID=Request.QueryString("CID")
    PCID=Request.QueryString("PCID")%>
<%DIM NUID%>
<%DIM SBU%>
<%Dim K%>
    <%SQLQT=Chr(39) %>

<%K=1%>
<table  cellpadding=7>
<% j="Yes" %>
<tr><td valign=top>

<tr><td>
<INPUT  type= "submit"  value= "Return To Me" id= submit6 name= submit6 class = "LDAButton2e" onclick = "location.href='Startmenu.asp?UID=<%=UID%>&PCID=<%=PCID%>'"></td>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td class="Subhead1b">&nbsp;&nbsp;&nbsp;Assign My Role to Candidate</td>
    </tr></table>

<table  cellpadding=5  cellspacing=3>

 <form id="form1" name="form1"  method="post" action="Role_Assign_1.asp?UID=<%=UID%>&PCID=<%=PCID%>">



 




<%  Dim FieldCount

%>

<% 

    
%>

<table border="1" cellpadding="3" cellspacing="0" width="620" >



 <tr><td bgcolor="#ffefd3" class="Subhead2w3"><font color="navy">Select Role</font></td><td>

   <select name="F_Role" id="F_Role" class="Subhead2w4"
          onchange = form1.submit();>
   


          <% set oRsSdat2 = server.CreateObject ("ADODB.Recordset") %>		  
<%if IsAdmin=1 then %>
<%strSQL3="SELECT JobTitle, ReportsTo from LDA_ROLE order by MGR_ID"%>
<%else %>
<%strSQL3="SELECT JobTitle, ReportsTo from LDA_ROLE where MGR_ID='" & UID & "' or Current_HOLDER='" & PCID & "'"%>
    <%end if%>

	 

		  <% set oRsSdat2 = server.CreateObject ("ADODB.Recordset") %>
          <% oRsSdat2.Open strSQL3, hrDSN %> 
       <option value="-SELECT-">-SELECT-</option>
                 <% Do While Not oRsSdat2.EOF %> 
          <option<%If Cstr(oRsSdat2.Fields(0))= Cstr(Request.Form("F_Role")) Then Response.Write(" selected")%>  value ="<%=oRsSdat2.Fields(0)%>">

          <%="-" & oRsSdat2.Fields(0)%>

          <% oRsSdat2.MoveNext()%>
          <% loop %>
    

          <% if oRsSdat2.Fields.Count>0 then  oRsSdat2.Close %>
          <% set oRsSdat2=nothing %>

      <option>      
         </select></td>
 

 <tr><td bgcolor="#ffefd3" class="Subhead2w3"><font color="navy">Select Candidate</font></td><td>

   <select name="F_Candi" id="F_Candi" class="Subhead2w4"
          onchange = form1.submit();>

          <% set oRsSdat2 = server.CreateObject ("ADODB.Recordset") %>		  
<%'if IsAdmin=1 then %>
<%strSQL3="SELECT Name,Cur_Title, CAN_ID, PCHEX_ID from LDA_CANDI order by Name,MGR_ID"%>
       <%'else %>
<%'strSQL3="SELECT Name,Cur_Title, CAN_ID, PCHEX_ID from LDA_CANDI where MGR_ID='" & UID & "'"%>
    <%'end if%>

	 

		  <% set oRsSdat2 = server.CreateObject ("ADODB.Recordset") %>
          <% oRsSdat2.Open strSQL3, hrDSN %> 
       <option value="-SELECT-">-SELECT-</option>
                 <% Do While Not oRsSdat2.EOF %> 
          <option<%If Cstr(oRsSdat2.Fields(0))= Cstr(Request.Form("F_Candi")) Then Response.Write(" selected")%>  value ="<%=oRsSdat2.Fields(0)%>">

          <%=oRsSdat2.Fields(0)%>

          <% oRsSdat2.MoveNext()%>
          <% loop %>
    

          <% if oRsSdat2.Fields.Count>0 then  oRsSdat2.Close %>
          <% set oRsSdat2=nothing %>

      <option>    
         </select></td>
     </tr>
    <tr>

    	<% strSQL= "Select * from LDA_CANSTatus where sortord<100 order by SortOrd asc "'"%>
      <% zcol="SH2c"%>
          <% set oRsV = server.CreateObject ("ADODB.Recordset") %>	
      <td bgcolor="#ffefd3" class="Subhead2w3"  align=left>Set Initial Candidate Readiness</td><td  class ="Subhead2w5"><select name="status1" id="status1"
        onchange = form_main.submit();>
          <% oRsV.Open strSQL, hrDSN %>

<% if Not oRsV.BOF And Not oRsV.EOF then %>
 
				<% Do While Not oRsV.EOF %>
					<option <%If oRsV.Fields(1) = Request.Form("status1")  Then Response.Write("selected ")%> value ="<%=oRsV.Fields(1)%>">
					<% = oRsV.Fields(1)%>
					<% oRsV.MoveNext() %>
				<% loop %>
<% end if %>
          <% oRsV.Close %>
                        <%GFLAG=1 %>
          <% set oRsV=nothing %>
                        <% %>
          </class="Subhead2w6">
  <% set oRsV=nothing %>  
                    <br />
 </td>

          <br />
          
</td>
 
   <tr><td></td><td class="Subhead2w4">If the Candidate you wish to assign does not show up on the drop down, go to "Manage Candidates" and drill down through Reports until you find them, then click<Font color="red"><b> ADD</b></Font></td>
        </tr>
    <tr><td></td><td class="Subhead2w4">You can now assign any Candidate to your Role, not just those in your organization. However not all employees may be loaded as Candidates, you may need to request the employees Manager to <Font color="red"><b>"ADD"</b></Font> the employee as a Candidate</td>
        </tr>
 <tr><td></td><td class="Subhead2w4"> For employee development you and your employee may wish to assign them to a Role outside your organization. In this case click on <Font color="red"><b>Use Roles Not Owned by Me</b></Font> for that selection.
     </tr>
</table>
     <%TDATE=Date %>
     <%strSQL1="Select Name, PCHEX_ID from LDA_USERS where id='" & UID & "'" 
       set oRsSdat2 = server.CreateObject ("ADODB.Recordset")
       oRsSdat2.Open strSQL1, hrDSN
         MYNAME=oRsSdat2("Name")
         MYID=oRsSdat2("PCHEX_ID")
         oRsSdat2.Close
         set oRsSdat2=nothing

     IF ADD="Y" THEN %>
      <%SQLQT=Chr(39)
		 FROLE=Request("F_Role")
		 FROLE=Replace(FROLE, SQLQT,SQLQT & SQLQT)
         FCANDI=Request("F_Candi")

             FCANDI=Replace(FCANDI,SQLQT,SQLQT & SQLQT)
             FSTATUS=Request("status1")
             if FSTATUS="RED" Then
              s1=0
             elseif FSTATUS="YELLOW" then
              s1=1
             elseif FSTATUS="GREEN" Then
              s1=2
             end if
    MYNAME=Replace(MYNAME,SQLQT,SQLQT & SQLQT)         
            If FCANDI="-SELECT-" or FROLE="-SELECT-" then
                 Response.write("<td ><Font color=RED Size=5><B>Incomplete Data Selection</B></Font></td>")
             else
                 set oRsSdat2 = server.CreateObject ("ADODB.Recordset")
                 strSQL1="Select PCHEX_ID, PCHEX_SUP_ID from LDA_CANDI where Name='" & FCANDI &"'"

                 oRsSdat2.Open strSQL1, hrDSN
                 CID=oRsSdat2("PCHEX_ID")
             SPCID=oRsSdat2("PCHEX_SUP_ID")
                 oRsSdat2.Close
             IF uid=1 or UID=2 then
                strSQL1="Select ID from LDA_ROLE where JobTitle='" & FROLE & "'"
             else
                 strSQL1="Select ID from LDA_ROLE where JobTitle='" & FROLE & "' and ((MGR_ID='" & UID & "') or (CURRENT_HOLDER='" & PCID & "'))"
             end if
     '        response.write(strSQL1)
	 
                 oRsSdat2.Open strSQL1, hrDSN
                 RID=oRsSdat2("ID")
                  oRsSdat2.Close
                 strSQL2="Select * from LDA_CAN_ROLE where CAN_ID='" & CID & "' and ROLE_ID='" & RID & "'"
                 oRsSdat2.Open strSQL2, hrDSN
                if oRsSdat2.eof=True then
                    oRsSdat2.close
                    strSQL2="Insert into LDA_CAN_ROLE values('" & CID & "','" & RID & "', '" & TDATE & "','" & MYNAME & "','" & MYID & "')"
                    oRsSdat2.Open strSQL2, hrDSN
                    strSQL2="SELECT ID from LDA_CAN_ROLE where CAN_ID='" & CID & "' and ROLE_ID='" & RID & "'"
                    oRsSdat2.Open strSQL2, hrDSN
                    CRID=oRsSdat2("ID")
                    oRsSdat2.Close
                    strSQL2="Insert into LDA_CAN_ROLE_GAP Values('" & CRID & "','No Data','No Data','No Data','" & Date() & "','" & FSTATUS & "', 'No Data','No Data','No Data','', '" & CID & "','" & SPCID & "','" & s1 & "','0', 'No Data','No Data','No Data')"
                '   response.write(strSQL2)
                    oRsSdat2.Open strSQL2, hrDSN
                    Response.write("<td ><Font color=Navy Size=5><B>&nbsp;&nbsp;...Added Succesfully</B></Font></td>")
                else
                   oRsSdat2.close
                   Response.write("<td ><Font color=RED Size=5><B>&nbsp;&nbsp;...Candidate Assignment Exists</B></FONT></td>")
                end if
         end if
   else
   end if
             
              zcol="SH2w" & s1%>
     <%targetpage="Role_Assign_1.asp?UID=" & UID & "&PCID=" & PCID &  "&CID=" & CID & "&ADD=Y"%>
<table border="0" cellpadding="3" cellspacing="0" width="600" >
    <tr><td></td></tr>
    <tr>
<td><input type="button" class="LDAButton2e" size="1" onclick="change_form_action('<%=targetpage%>');"  value="Assign Role"></td>
        <td></td>
 <%targetpage="Role_Assign_2.asp?UID=" & UID & "&PCID=" & PCID &  CID &  "&CID=" & "&ADD=N"%>
<td><input type="button" class="LDAButton2ROLE" size="1" onclick="change_form_action('<%=targetpage%>');"  value="Use Roles Not Owned By Me"></td>
    </tr>
    <%response.write("<td>x" & s1 & FCANDI & "</td>") %>


</table>



  



</body>
</html>

Open in new window

Avatar of HainKurt
HainKurt
Flag of Canada image

what is "/LDA/Role_Assign_1.asp, line 231"
show that line in the code please...
ASKER CERTIFIED SOLUTION
Avatar of HainKurt
HainKurt
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
and pls post the query for RS that is failing on  line 231 (response.write)
Check that query and your data... it is returning empty result probably...
Avatar of David Johnson, CD
My first impression is 'what a mess'.

What you should do is pare out 90% of the unnecessary code that is needed for debugging.  Pare it down to the barest minimum that will show the error.

Sprinkle a few comments in your code so we have a clue of what a section is trying to do.. Imagine going back to this code 6 months to a year later and try and remember what you where trying to do.  

Proper Indentation of your code would also help.

Is this site .asp ?? it sure doesn't look like C# or asp.net to me.
Why are you using a 19 year old editor
.ASP is an ancient technology
ASP.net was released 15 years ago!

Which code segment is line 431.. ths source you submitted line 431 is a blank line
Avatar of Stacie

ASKER

This is where the line of code is failing, on the:   RID=oRsSdat2("ID")

 oRsSdat2.Open strSQL1, hrDSN
                 RID=oRsSdat2("ID")
                  oRsSdat2.Close
                 strSQL2="Select * from LDA_CAN_ROLE where CAN_ID='" & CID & "' and ROLE_ID='" & RID & "'"
                 oRsSdat2.Open strSQL2, hrDSN

Open in new window

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I believe the query was not returning any data and op was trying to get data without checking if there is a record or not...