D. Johnson
|
Posted: 12/25/2002, 4:19 PM |
|
There have been many requests for adding the login information to a page. Most of them will get the login name. I wanted to welcome the user by first name. I decided to use the CCDLookup function(CCS). This function uses the column,table,where,connection to retrieve your data. Since the connection is open before the header is shown, the following code will display the first name of the user that is stored in an Access database with a table named users. I used this in the Portal example in the header code. I added a row and in the row a Label called user_id. My connection is whc(DBwhc), so change that to your connection name. You can set the class of the <td> to display the name in your choice of font color, size, alignment etc. It's simple but it works. I added this code to the BeforeShow event.
Dim WelcomeName
If Session("PortalUserId") >= 1 Then
WelcomeName = CCDLookup("first_name", "users", "user_id =" & Session("PortalUserID"), DBwhc)
header.user_id.Value = "Welcome " & WelcomeName
else
header.user_id.Value = "Welcome"
End If
|
|
|
Sean
|
Posted: 11/03/2003, 8:45 AM |
|
I used this code in my CCS project, (ASP 3.0 W/templates, Access 2000, CCS 2.2) but it is not working like I thought it would. It seems to work fine on any page that already has a grid, but on my menu pages, it gives an error. The error: Variable is undefined: 'DBTDI'
These are pages that I don't have an established connection to my database. How can I get this to show up on all pages?
I would also like to modify this a bit and could use some help. I would like it to pull the First Name (FName) and Last Name (LName) instead of just the first name.
Thanks.
|
|
|
|