Print Page | Close Window

Same ASP question made easier....

Printed From: Web Wiz Forums
Category: Web Wiz Web App Support Forums
Forum Name: Web Wiz Forums
Forum Description: Support forum for Web Wiz Forums application.
URL: https://forums.webwiz.net/forum_posts.asp?TID=815
Printed Date: 29 March 2026 at 3:19pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Same ASP question made easier....
Posted By: fernan82
Subject: Same ASP question made easier....
Date Posted: 07 March 2003 at 6:32pm
Ok, this is the code i'm using right now:

If Not intGroupIDInfo = 3 And Not intGroupIDInfo = 7 Then Response.Redirect "insufficient_permission.asp"

What I want to do is include the 3 and the 7 in a single variable (and be able to add more numbers to the var), to be able to add as many numbers (which are user groups) as i want without having to comparison line... Any suggestions are greatly appreciated.

Fernan



Replies:
Posted By: boyohboy
Date Posted: 07 March 2003 at 6:49pm

well, several ways you can do:

store 3,7,8,#,... in a string or a db field (later assign to a strVar), which are all SINGLE VARIABLE. When you check, do

Instr(intgroupid, storedstring)



-------------
Visit my community website @
http://www.everythingviet.com - EverythingVIET.com


Posted By: fernan82
Date Posted: 07 March 2003 at 7:02pm
Sorry man.....i still don't get it....please have in mind this is my first time coding asp so i got strVar = "3,7,8" how do i compare them to intGroupID?

Thanks in advance...


Posted By: boyohboy
Date Posted: 07 March 2003 at 7:15pm

ok, intGroupIDinfo always has "3" or "7", "4" or any number, correct?
And, you have stringVariable = "3,6,7,8"  and you may add more anytime, correct?

Use

If InStr(stringVariable, CStr(intGroupIDinfo)) <> 0 Then  'case found

the function will look into stringVariable for intGroupIDinfo. As soon as it find 3 or 7 exist in the string "3,6,7,8" it will return a non-Zero (ie the position of the found character). Then, you  can do whatever you want.



-------------
Visit my community website @
http://www.everythingviet.com - EverythingVIET.com


Posted By: fernan82
Date Posted: 07 March 2003 at 7:50pm
Thanks a lot boyohboy!!!



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net