Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: authorising users from 2 tables


Message #1 by "Duncan Soar" <dsoar@s...> on Wed, 28 Aug 2002 17:59:23
Probably a basic question (I hope) but any help would be welcome...

I've got a login page working fine authorising username/password 
from one table ("assistants"). I've now set up another table 
("USAssistants")  with more users in but want to use the same login 
page. All usernames across the tables are unique, so I want to be 
able to see if the username/password combination is in the first table 
& if not, then to look in the second table. For the life of me I can't get 
this to work - have tried "select * from assistants, USAssistants 
where Username=...." but keep getting error message.

Can anyone sort me out?

Thanks! 
Message #2 by "Daniel Groh" <daniel.groh@s...> on Wed, 28 Aug 2002 14:18:42 -0300
Hi Buddie, look here

<%
sql_a = "SELECT * FROM assistants WHERE Username = '"&user&"' and Password 
'"&pass&"'"
Set rs1 = connection.execute (sql_a )

sql_b = "SELECT * FROM USAssistants WHERE Username = '"&user&"' and Password
= '"&pass&"'"
Set rs2 = connection.execute (sql_b)

if rs1.eof and rs2.eof then
  response.write "user not found in database"
elseif not rs1.eof and rs2.eof
  response.write "record was found in table assistants"
elseif not rs2.eof and rs1.eof
  response.write "record was found in table USAssistants"
end if

%>

Did u get it?

Cya

But plz, verify if the condition ELSE IF is togheter or separated

Daniel, Brazilian guy


----- Original Message -----
From: Duncan Soar <dsoar@s...>
To: Access ASP <access_asp@p...>
Sent: Wednesday, August 28, 2002 5:59 PM
Subject: [access_asp] authorising users from 2 tables


> Probably a basic question (I hope) but any help would be welcome...
>
> I've got a login page working fine authorising username/password
> from one table ("assistants"). I've now set up another table
> ("USAssistants")  with more users in but want to use the same login
> page. All usernames across the tables are unique, so I want to be
> able to see if the username/password combination is in the first table
> & if not, then to look in the second table. For the life of me I can't get
> this to work - have tried "select * from assistants, USAssistants
> where Username=...." but keep getting error message.
>
> Can anyone sort me out?
>
> Thanks!
>

Message #3 by "Duncan Soar" <dsoar@s...> on Wed, 28 Aug 2002 20:39:54
You're a star! Thanks very much. Working perfectly now.




> Hi Buddie, look here

<%
sql_a = "SELECT * FROM assistants WHERE Username = '"&user&"' 
and Password 
'"&pass&"'"
Set rs1 = connection.execute (sql_a )

sql_b = "SELECT * FROM USAssistants WHERE Username = 
'"&user&"' and Password
= '"&pass&"'"
Set rs2 = connection.execute (sql_b)

if rs1.eof and rs2.eof then
  response.write "user not found in database"
elseif not rs1.eof and rs2.eof
  response.write "record was found in table assistants"
elseif not rs2.eof and rs1.eof
  response.write "record was found in table USAssistants"
end if

%>

Did u get it?

Cya

But plz, verify if the condition ELSE IF is togheter or separated

Daniel, Brazilian guy


----- Original Message -----
From: Duncan Soar <dsoar@s...>
To: Access ASP <access_asp@p...>
Sent: Wednesday, August 28, 2002 5:59 PM
Subject: [access_asp] authorising users from 2 tables


> Probably a basic question (I hope) but any help would be 
welcome...
>
> I've got a login page working fine authorising username/password
> from one table ("assistants"). I've now set up another table
> ("USAssistants")  with more users in but want to use the same 
login
> page. All usernames across the tables are unique, so I want to be
> able to see if the username/password combination is in the first 
table
> & if not, then to look in the second table. For the life of me I can't get
> this to work - have tried "select * from assistants, USAssistants
> where Username=...." but keep getting error message.
>
> Can anyone sort me out?
>
> Thanks!
>


  Return to Index