|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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 |
|
#2
|
||||
|
||||
|
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 |
|
#3
|
|||
|
|||
|
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 :-(( |
|
#4
|
||||
|
||||
|
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. |
|
#5
|
||||
|
||||
|
What is the error? Try
Code:
if (RSA("student_password")=Request("txtPASSWORD")) or (RSA2("teacher_password")=Request("txtPASSWORD")) then
|
|
#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
|
|
#7
|
|||
|
|||
|
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! |
|
#8
|
||||
|
||||
|
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.
|
|
#9
|
|||
|
|||
|
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 |
|
#10
|
|||
|
|||
|
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. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > if-then-elseif problem ? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|