asa dyo

asa dyo

  • 1.8k
  • 9
  • 123

multiple login with 3 table (lecturer,student,role) asp c#

May 3 2019 1:32 PM
 Hye I have a  login form that has username and password textbox. I also have 2 radio button for 2 role which is Lecturer and Student.
For the table in the database, I have Staff table(Lecturer), Student table and Position table(role).
The problem is I don't know how to make when the user enters username and password and choose one role for example lecturer, the username and password will enter the lecturer table and vice versa.
I hope I can get some tips and clues from here and I'm sorry if this question sounds dumb but I don't know what to do anymore.
 
Here is the interface for login page: 
 
  
Sql for table Staff
 
CREATE TABLE [dbo].[Staffs] (
[StaffsID] INT NOT NULL,
[StaffName] NCHAR (10) NOT NULL,
[StaffPw] NCHAR (10) NOT NULL,
[UpdatedBy] NCHAR (10) NULL,
[UpdatedOn] DATETIME NULL,
[PositionID] NCHAR (10) NOT NULL,
PRIMARY KEY CLUSTERED ([StaffsID] ASC),
CONSTRAINT [FK_Staffs_PositionID] FOREIGN KEY ([PositionID]) REFERENCES [dbo].[Positions] ([PositionID])
);
 
SQL for table student
 
CREATE TABLE [dbo].[Students] (
[StudID] INT NOT NULL,
[StudName] NCHAR (10) NULL,
[StudPw] NCHAR (10) NULL,
[StudEmail] NCHAR (10) NULL,
[UpdatedOn] DATETIME NULL,
[UpdatedBy] NCHAR (10) NULL,
PRIMARY KEY CLUSTERED ([StudID] ASC)
);
 
SQL for table position
 
CREATE TABLE [dbo].[Positions] (
[PositionID] NCHAR (10) NOT NULL,
[PositionName] NCHAR (10) NULL,
PRIMARY KEY CLUSTERED ([PositionID] ASC)
);
 

Answers (1)