?
Solved

Redirect with parameter if Recordset has only one record

Posted on 2011-10-24
3
Medium Priority
?
178 Views
Last Modified: 2012-05-12
I want to redirect a user if their recordset has only one result.  When they are redirected, I need to pass the url variable.  Otherwise, I will leave them on the results.asp page.  
This is the code I have so far, but it does not work:

<%
If rsCustomerData_total = 1 Then
Response.Redirect("ContactManagementActivityAdd.asp? & var_Table_ID=(rsCustomerData.Fields.Item("Table_ID").Value)")
End If
%>
0
Comment
Question by:drelinger
  • 2
3 Comments
 
LVL 34

Expert Comment

by:Big Monty
ID: 37020323
have a look at the recordCount property - http://www.w3schools.com/ADO/prop_rs_recordcount.asp
0
 

Author Comment

by:drelinger
ID: 37020481
any hints on syntax to include the required parameter in the url ?
0
 
LVL 34

Accepted Solution

by:
Big Monty earned 2000 total points
ID: 37020549
when you say URL variable, I assume you want the Table_ID value from the recordset passed?

<%
rsCustomerData.Open sql, conn

if rsCustomerData.RecordCount = 1 then
     Response.Redirect( "ContactManagementActivityAdd.asp?&var_Table_ID=" & rsCustomerData.Fields.Item("Table_ID").Value )
End If
%>
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

807 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