Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old February 8th, 2005, 06:20 AM
Friend of Wrox
Points: 8,019, Level: 38
Points: 8,019, Level: 38 Points: 8,019, Level: 38 Points: 8,019, Level: 38
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2005
Location: Mauchline, East Ayrshire, Scotland
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default response.redirect

<%
rscheck=con.execute("select * from authusers_reg where agencyid = '"& agencyid &"'")

if rscheck = "" then
response.redirect "reg.asp"
end if
%>

I have this code above.

I am looking for the script to do a check on the authusers_reg to see if there are any records matching the 'agencyid' which is MK. If there are NOT then I want it to redirect the user to 'reg.asp'.

Would this code work?

Thanks.

Picco

www.crmpicco.co.uk
__________________
_______________________
Ayrshire Minis - a Mini E-Community
http://www.ayrshireminis.com
http://www.crmpicco.co.uk
  #2 (permalink)  
Old February 8th, 2005, 06:35 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Copenhagen, , Denmark.
Posts: 440
Thanks: 0
Thanked 0 Times in 0 Posts
Default

First of all... Which type is your agencyid? Do you need the extra ' signs?

Moreover the SELECT statement could look a bit different; e.g. you could use the COUNT function to count the rows matching the condition, and then check to see if this number is above 0.

It is something like...
Code:
SELECT COUNT(*) AS agencyCount FROM authusers_reg WHERE agencyid = [someID]
... and then you should be able to retrieve the value something like this...
Code:
rscheck("agencyCount")
You might have to remember that you should do some conversion, if you are comparing the value to some integer. The code you posted will not work as far as I know.

Hope it helps.

Jacob.
  #3 (permalink)  
Old February 8th, 2005, 06:38 AM
Authorized User
 
Join Date: Aug 2004
Location: Calicut, Kerala, India.
Posts: 58
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Try the code below
 <%

set rscheck=con.execute("select * from authusers_reg where agencyid = '"& agencyid &"'")

if not rscheck.eof then
response.redirect "reg.asp"
end if
%>

Shibu Narayanan
Software Associates
  #4 (permalink)  
Old February 9th, 2005, 01:50 AM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

;;;Would this code work?
No, an element within the object can be compared to a "" not the object its self

You say:
;;;If there are NOT then I want it to redirect the user to 'reg.asp'

Follow Shibu's suggestion however change:
if not rscheck.eof then
response.redirect "reg.asp"
end if

To:
if rscheck.eof then
response.redirect "reg.asp"
end if


Wind is your friend
Matt


Similar Threads
Thread Thread Starter Forum Replies Last Post
Response.Redirect in c# class. manish.sharma04 BOOK: Professional ASP.NET 2.0 and Special Edition; ISBN: 978-0-7645-7610-2; ISBN: 978-0-470-04178-9 17 February 28th, 2012 07:01 PM
response.redirect sarah lee ASP.NET 1.0 and 1.1 Basics 1 October 27th, 2006 08:57 AM
response.redirect ava_h .NET Framework 2.0 0 October 18th, 2006 10:21 PM
Using response.redirect wi shs BOOK: Beginning ASP.NET 1.0 3 April 2nd, 2004 09:54 AM
Response.Redirect dhborchardt Classic ASP Basics 4 June 16th, 2003 05:56 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.