Solved

No recrodset check

Posted on 1998-10-01
6
173 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

746 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

13 Experts available now in Live!

Get 1:1 Help Now