Solved

No recrodset check

Posted on 1998-10-01
6
174 Views
Last Modified: 2013-12-25
I was wondering if there is a way to do a check on a SQL table and if the check came back with the No Current Record error to display one thing, but if the check did find a record to display another thing. Here is what I tried and mean.

<% If Not IsEmpty(rsDBC("vchCardNumber")) Then%>
<table>
      <tr>
            <td>Credit Card Number:</td>
            <td><input type="text" name="CC" size="20" value="<% = rsDBC("vchCardNumber")%>"></td>
            <td><img src="../images/required.gif"></td>
      </tr>
      <tr>
            <td>Expiration Date</td>
            <td><input type="text" name="Expiration" size="6" value="<% = rsDBC("vchExpDate")%>">
            <img src="../images/required.gif"></td>
      </tr>
<% Else %>
<table>
      <tr>
            <td>Credit Card Number:</td>
            <td><input type="text" name="CC" size="20"></td>
            <td><img src="../images/required.gif"></td>
      </tr>
      <tr>
            <td>Expiration Date</td>
            <td><input type="text" name="Expiration" size="6" >
            <img src="../images/required.gif"></td>
      </tr>
<% End If %>
 Thanks
0
Comment
Question by:yolish
  • 3
  • 2
6 Comments
 

Accepted Solution

by:
callapm earned 50 total points
ID: 1855396
Have you tried the RecordCount property of the RecordSet object?  

<%   DIM varCount
        varCount = rsDBC.RecordCount
        If varCount >0 Then%>

of course, for this to work, you would have to execute an SQL statement that would select that field only from the database you are working with.  Create a new recordset, and use the code above - replacing the recordset name, though.  

hope this helps
0
 
LVL 28

Expert Comment

by:sybe
ID: 1855397
If Not RS.EOF
0
 

Author Comment

by:yolish
ID: 1855398
The If Not rs.eof worked, thank you very much for the help
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 28

Expert Comment

by:sybe
ID: 1855399
Thanks, but you gave the points to callapm
0
 

Author Comment

by:yolish
ID: 1855400
Sorry, how would I have gave you the points, if callapm had a lock on the question?
0
 
LVL 28

Expert Comment

by:sybe
ID: 1855401
you could have rejected the answer, then the question is open again.

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

867 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now