Solved

BOF or EOF

Posted on 2006-11-03
8
322 Views
Last Modified: 2006-11-18
Hello,

I have a small problem and would be grateful for some help.

     <% If  cint(Recblockblockunblockif_else.Fields.Item("worker_uid").Value) = cint(Session("pt_login_id"))
 AND  cint(Recblockblockunblockif_else.Fields.Item("blocker_id").Value) = cint(RecmostofDuser.Fields.Item("id_usr").Value) Then  %>
          <h1>free and open</h1><% Else %>this user is blocked <% End If %>

The above works  if  Recblockblockunblockif_else is not empty, but when it is empty I get a Either BOF or EOF is True error, what can I do to it to work if there is no record.

regards and thanks for any help

Kenny
0
Comment
Question by:thatelvis
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
8 Comments
 
LVL 16

Accepted Solution

by:
CWS (haripriya) earned 125 total points
ID: 17872170
First check whether the recordset is empty or not like this:


<%
If Recblockblockunblockif_else.EOF = false then

If  cint(Recblockblockunblockif_else.Fields.Item("worker_uid").Value) = cint(Session("pt_login_id"))
 AND  cint(Recblockblockunblockif_else.Fields.Item("blocker_id").Value) = cint(RecmostofDuser.Fields.Item("id_usr").Value) Then  %>
          <h1>free and open</h1><% Else %>this user is blocked
<%
End If
else
%>
<b>No record to display</b>
<%
End if
%>
0
 
LVL 1

Author Comment

by:thatelvis
ID: 17873207
Cyberweb Thank you,
have a great weekend.

regards

Kenny
0
 
LVL 1

Author Comment

by:thatelvis
ID: 17873380
Hi again, Sorry I jumped the gun a little



the code you helped me with below. I only want one else, where as if the recordset is not empty and has the two values then   <h1>free and open</h1><% Else %>this user is blocked , below you gave me 2 elses, how can I modift it to have only the one else. thanks again.

Kenny




<%
If Recblockblockunblockif_else.EOF = false then

If  cint(Recblockblockunblockif_else.Fields.Item("worker_uid").Value) = cint(Session("pt_login_id"))
 AND  cint(Recblockblockunblockif_else.Fields.Item("blocker_id").Value) = cint(RecmostofDuser.Fields.Item("id_usr").Value) Then  %>
          <h1>free and open</h1><% Else %>this user is blocked
<%
End If
else
%>
<b>No record to display</b>
<%
End if
%>
0
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 
LVL 16

Expert Comment

by:CWS (haripriya)
ID: 17873518
<%
If Recblockblockunblockif_else.EOF = false then

If  cint(Recblockblockunblockif_else.Fields.Item("worker_uid").Value) = cint(Session("pt_login_id"))
 AND  cint(Recblockblockunblockif_else.Fields.Item("blocker_id").Value) = cint(RecmostofDuser.Fields.Item("id_usr").Value) Then  %>
          <h1>free and open</h1><% Else %>this user is blocked
<%
End If
End if
%>


and thanks for points!
:-)
0
 
LVL 1

Author Comment

by:thatelvis
ID: 17873578
wowa,

ok when the user is blocked this shows "this user is blocked", but when the user is not blocked it shows nothing where as it should show   <h1>the user is not blocked</h1>, I find this so confusing, sorry to be a bother if you have any ideas i would be grateful, I wish I had given more points for this and didnt mean to close it so soon.

<%
If Recblockblockunblockif_else.EOF = false then

If  cint(Recblockblockunblockif_else.Fields.Item("worker_uid").Value) = cint(Session("pt_login_id"))
 AND  cint(Recblockblockunblockif_else.Fields.Item("blocker_id").Value) = cint(RecmostofDuser.Fields.Item("id_usr").Value) Then  %>
          <h1>the user is not blocked</h1><% Else %>this user is blocked
<%
End If
End if
%>
0
 
LVL 1

Author Comment

by:thatelvis
ID: 17873793
I have re asked this question in the forum as I needed to resolve this in a hurry, no offence , and thanks for your help.

Kenny

0
 
LVL 16

Expert Comment

by:CWS (haripriya)
ID: 17879129
hi kenny,

Sorry there is a delay in answering because of the time difference. When you are working, for me it is bed-time.
I think you would have already solved the problem.

My kind advice, first check the results carefully and then accept the answer.

Good Luck
0
 
LVL 1

Author Comment

by:thatelvis
ID: 17879594
Thanks I totally understand , have a great week.

regarsd

Kenny
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Now that Expression Web 4.0 (http://www.microsoft.com/expression/products/Upgrade.aspx) is free if you buy or have the full version of Expression Web 3.0, now is the best time to  migrate from FrontPage to Expression Web (http://www.frontpage-to-exp…
This guide will walk you through the essential considerations and tech stack for building scalable websites. Know how to grow your business the smart way!
The purpose of this video is to demonstrate how to insert an Iframe into WordPress. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Open Page or Post…
The purpose of this video is to demonstrate how to prevent comment spam on a WordPress Website. This will be demonstrated using a Windows 8 PC. Plugin Akismet will be used. Go to your WordPress login page. This will look like the following: myw…

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question