SunQuest
           ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old August 22nd, 2003, 10:08 AM
aspuser25 aspuser25 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 141 aspuser25 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
if-then-elseif problem ?

hi ...

i am checking if the password is matching with either the student_table or the teacher_table then it shoudl display "welStudent.asp" page else it sould go to another page called "newstudent.asp".

I have created 2 recodsets because i need 2 different queries to be executed using 2 diff tables:

Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open ConnString
QUERY1 = "SELECT student_password from student_info Where student_username='" &Request("txtNAME")&"'"
Set RSA = Conn.Execute(QUERY1)

QUERY2 = "SELECT teacher_password from teacher_info Where teacher_username='" &Request("txtNAME")&"'"
Set RSA2 = Conn.Execute(QUERY2)

its continously giving error on this line :-(((

if RSA("student_password")=Request("txtPASSWORD") or RSA2("teacher_password")=Request("txtPASSWORD") then

cant i use the 2 recordsets??? in one if- then-else condition? I am attachign my script for reference.
I ahve even tried to create 2 adodb connections (which may sound sillly ...!) but nothign is working....

any thots?? or suggestions

thanks in advance for such painful help!
janet
Attached Files
File Type: asp logindb2.asp (1.5 KB, 151 views)

Reply With Quote
  #2  
Old August 22nd, 2003, 10:33 AM
don_sparko's Avatar
don_sparko don_sparko is offline
Digitally Challenged
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 280 don_sparko User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 54 m 14 sec
Reputation Power: 6
maybe your problem is with your Request statement. i think it should be Request.form("txtPassword"). let me know
__________________
My brain cells are like a storm trooper's armor: useless

Reply With Quote
  #3  
Old August 22nd, 2003, 12:22 PM
aspuser25 aspuser25 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 141 aspuser25 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Question

no its not the problem with request.form...
bec this script ran very nicely when i was takign one table into account..the moment i took 2 table verification of password it fails :-((

Reply With Quote
  #4  
Old August 22nd, 2003, 12:26 PM
don_sparko's Avatar
don_sparko don_sparko is offline
Digitally Challenged
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 280 don_sparko User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 54 m 14 sec
Reputation Power: 6
humor me and put the .form in and let me know what happens
ah wait here is another idea, try checking each for eof that will determine if they are empty and then you don't have to check to compare them, i think that is causing your error. give that a shot

Last edited by don_sparko : August 22nd, 2003 at 12:30 PM.

Reply With Quote
  #5  
Old August 22nd, 2003, 12:27 PM
karsh44's Avatar
karsh44 karsh44 is offline
Just another guy
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Jun 2003
Location: Wisconsin
Posts: 2,915 karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 6 Days 13 h 6 m 22 sec
Reputation Power: 76
What is the error? Try
Code:
if (RSA("student_password")=Request("txtPASSWORD")) or (RSA2("teacher_password")=Request("txtPASSWORD")) then 
The .form is not the problem, it works either way.

Reply With Quote
  #6  
Old August 22nd, 2003, 12:30 PM
don_sparko's Avatar
don_sparko don_sparko is offline
Digitally Challenged
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 280 don_sparko User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 54 m 14 sec
Reputation Power: 6
ah wait here is another idea, try checking each for eof that will determine if they are empty and then you don't have to check to compare them, i think that is causing your error. give that a shot

Reply With Quote
  #7  
Old August 22nd, 2003, 12:37 PM
aspuser25 aspuser25 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 141 aspuser25 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Error Type:
(0x80020009)
Exception occurred.
/myweb/loginDB2.asp, line 39


this line 39 is :
if RSA("student_password")=Request.form("txtPASSWORD") or
RSA2("teacher_password")=Request.form("txtPASSWORD") then
i tried putting brackets...already...in if then ...no help!


i cudnt make out what u mean 'check each for eof'...

i tried this :
If RSA.EOF and RSA2.EOF Then
Response.Write("Invalid Login!!! ")
server.transfer("newStudent.asp")
else
server.transfer("welStudent.asp")
end if .it does work ... but if i give wrong password and correct username it enters the welstudent.asp.... which is shudnt . it shud enter newstudent.asp!

Reply With Quote
  #8  
Old August 22nd, 2003, 01:18 PM
karsh44's Avatar
karsh44 karsh44 is offline
Just another guy
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Jun 2003
Location: Wisconsin
Posts: 2,915 karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 6 Days 13 h 6 m 22 sec
Reputation Power: 76
Change the "and" to "or" in your check for eof. As it is now, it only needs one of the fields to be correct in order to go to "welStudent.asp". Changing to "or" will make it work like you want.

Reply With Quote
  #9  
Old August 22nd, 2003, 04:44 PM
zimm zimm is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 30 zimm User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
I think Karsh is right. You need to make sure that neither recordset is at BOF or EOF. Might be overkill, but I ALWAYS check for BOF and EOF EVERY TIME I LOAD A RECORDSET.

Like this (I always use reverse logic)

'if this test passes, you know that you've got some data in both recordsets
If (not rs1.bof and not rs1.eof) or (not rs2.bof and not rs2.eof) then
blah blah blah

end if

Reply With Quote
  #10  
Old August 23rd, 2003, 06:27 AM
unatratnag unatratnag is offline
Average Intelligence
Dev Shed Novice (500 - 999 posts)
 
Join Date: Apr 2003
Location: Ohio/Chicago
Posts: 678 unatratnag User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 22 sec
Reputation Power: 6
Send a message via AIM to unatratnag
or just do your query, on on the return

if RS.eof then
error message or redirect
else
continue program
end if.

http://www.activeserverpages.ru/ADO/daprop01_5.htm

hope this helps.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > if-then-elseif problem ?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway