Unique user ID login needs to make certain database info available (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


jheun -> Unique user ID login needs to make certain database info available (6/8/2008 17:44:06)

I am working in ASP with Expression Web, but have access to FrontPage 2003.

I would like a user to log in, take an assessment (the results of which are stored in a database), and be able to see the results of only his/her assessment results.

Essentially what I need is a user to see only his/her results from tests taken. The test results from many different users will be stored in one Access database.

Could someone kindly please tell me what am I looking to install codewise on pages to ensure the user sees this specific information? I would be VERY much appreciative of support. This is going to help me with my Masters' project.




DesiMcK -> RE: Unique user ID login needs to make certain database info available (6/9/2008 2:58:45)

I have a similiar setup. I provide classwork/homework/grade info for students by using session variables.

When the students logs on, I create a session variable called UserID. Then in the releveant SQL statements I use
... WHERE PupilID = '" & Session("UserID") & "'....

Is this enough to get you started or do you want more specific code?

Desi




jheun -> RE: Unique user ID login needs to make certain database info available (6/9/2008 20:01:58)

Desi,
Yes, please, could you provide some more specific code? I am going to give it a try, but just in case....

You are awesome. Thanks for your help again!




DesiMcK -> RE: Unique user ID login needs to make certain database info available (6/10/2008 15:25:35)

Hi,

this is how my system works. I have a db table that is called tblUsers. It contains the staff details. Each teacher has a three letter UNIQUE ID eg - I am DMC.

When a teacher logs in I check their credientials - similar to your login page. I have set the teacher's Username as their unique ID. This way I can use the username throughout the session. I create a session variable and the call it during the sql statements.

Does that make sense?

So basically,

on my login check page I use:

strSQL = "SELECT * FROM tblUsers WHERE tblUsers.UserID ='" & strUserName & "'"

'Query the database
rsCheckUser.Open strSQL, strCon

'If the recordset finds a record for the username entered then read in the password for the user
If NOT rsCheckUser.EOF Then

'Read in the password for the user from the database
If (Request("txtUserPass")) = rsCheckUser("Password") Then



'If the password is correct then set the session variables

Session("UserID") = rsCheckUser("UserID")

So thoroughout my db I use this UserID. For example tblCLass has two fields, UserID, ClassID. If I want to list the classes that a teacher has I would query tblClass which sql like:

"SELECT * FROM tblCLass WHERE UserID = '" & Session("UserID") & "'"




jheun -> RE: Unique user ID login needs to make certain database info available (6/25/2008 10:13:39)

Sorry I have not replied sooner, other tasks took precedent. Thank you for posting this. I am going to try it out. Regards!




jheun -> RE: Unique user ID login needs to make certain database info available (6/25/2008 11:30:59)

OK, I think I get it, but how do I call the session ID on subsequent pages? One of those pages, by the way, will have to be an aspx page since I dont know how to get the table data to appear for the user's information.




jheun -> RE: Unique user ID login needs to make certain database info available (6/25/2008 14:00:40)

Desi,

I GOT IT!! I used some help you gave me with my last post (the one with the writing login timestamp results to a database). I used cookies to bring up test results.




DesiMcK -> RE: Unique user ID login needs to make certain database info available (6/25/2008 15:41:48)

Nice one. Just for interest - to call a session variable it's simply

Session("UserID")

so your SQL may look like:

"SELECT * FROM Table where UserID = '" & Session("UserID") & "'"

Desi




jheun -> RE: Unique user ID login needs to make certain database info available (6/28/2008 21:32:26)

Thanks, Desi, You rock!




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.0625