This topic is locked

List.asp based on Session UserID

4/29/2007 2:44:43 PM
ASPRunnerPro General questions
M
mlgill author

Don't know what I'm missing. I am using the below code to open up a List.asp based on a single table (no joins). This table includes a field named "Assign_to". I want the page to load with only records where the "Assign_to" field matches the logged in user. I don't get a specific error, just that it can't load the page. ALL HELP GREATLY APPRECITED!
Sub ListOnLoad()

'** Check if specific record exists ****

strSQLExists = "select * from ISSUES where Assign_to ='Session("UserID")'"

set rsExists = CreateObject("ADODB.Recordset")

rsExists.Open strSQLExists, dbConnection
if not rsExists.eof then

' if record exists do something
else

' if dont exist do something else
end if

rsExists.Close : set rsExists = Nothing
End Sub

C
clig 4/30/2007

Use OwnerID - Or just use built security function - This particular table users can only see and edit their own records...

M
mlgill author 4/30/2007

Actually, all users are allow to see all records. I am just trying to make a quick short cut menu item that when clicked will show only that users open items. THANKS

F
funklet 4/30/2007

The syntax for building the SQL string is:
select something from sometable where something = '" & Session("UserID") & "'"
to further clarify I have added spaces to show what the characters are:
something = ' " & Session("UserID") & " ' "
Kind Regards.