danblack30
MIS
What I'm trying do is populate a drop down list with pagelinks that aren't already assigned to a user
I have three tables USERACCESS (userid, username, userpassword, userlevel) , LINKDETAIL (id, userid, pagelinkdetail) , and PAGELINKS (pagelinkid, pagelinks).
USERACCESS userid(1) inner join LINKDETAIL userid(many)
PAGELINK pagelinkid(1) inner join LINKDETAIL pagelinkiddetail(many)
There will be several different userid's, with access to many pagelinks.
I have the recordset not equal to the userid and that works great until I add a user with access to the same link.
For example;
user 1 has access to pages abce
user 2 has access to pages def
the recordset throws out all records that equal user1 but the page "e" is still in the dropdown when user1 refreshes the page cause its also available to user2. Only pages D, and F should be available.
here's the code:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/conntesttsrserv.asp" -->
<%
Dim Recordset1__MMColParam
Recordset1__MMColParam = "1"
If (Request.QueryString("UserID")<> "") Then
Recordset1__MMColParam = Request.QueryString("UserID")
End If
%>
<%
Dim Recordset1
Dim Recordset1_numRows
Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_conntesttsrserv_STRING
Recordset1.Source = "SELECT useraccess.UserID, useraccess.Username, linkdetail.pagelinkIDdetail, pagelinks.pagelinks FROM useraccess INNER JOIN (pagelinks INNER JOIN linkdetail ON pagelinks.pagelinkID = linkdetail.pagelinkIDdetail) ON useraccess.UserID = linkdetail.userID WHERE useraccess.UserID<>" + Replace(Recordset1__MMColParam, "'", "''") + ""
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()
Recordset1_numRows = 0
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
<table width="100%" height="82" border="0">
<tr>
<td><form name="form1" method="post" action="">
<p>
Username
<%=(Recordset1.Fields.Item("Username").Value)%>
</p>
<p> pagelinks
<select name="pagelinkid" id="pagelinkid">
<%
While (NOT Recordset1.EOF)
%>
<option value="<%=(Recordset1.Fields.Item("pagelinkIDdetail").Value)%>"><%=(Recordset1.Fields.Item("pagelinks").Value)%></option>
<%
Recordset1.MoveNext()
Wend
If (Recordset1.CursorType > 0) Then
Recordset1.MoveFirst
Else
Recordset1.Requery
End If
%>
</select>
</p>
<p>
<input type="submit" name="Submit" value="Add pagelink">
</p>
</form></td>
</tr>
</table>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>
Is there any way this could work? Recode or redesign the database?
I thought maybe have two recordsets one that equals the pagelinks and another that doesn't equal the userid and doesn't equal anything in the first recordset, but I can't seem to get that to work.
Any help is greatly appreciated.
Thanks,
Dan
I have three tables USERACCESS (userid, username, userpassword, userlevel) , LINKDETAIL (id, userid, pagelinkdetail) , and PAGELINKS (pagelinkid, pagelinks).
USERACCESS userid(1) inner join LINKDETAIL userid(many)
PAGELINK pagelinkid(1) inner join LINKDETAIL pagelinkiddetail(many)
There will be several different userid's, with access to many pagelinks.
I have the recordset not equal to the userid and that works great until I add a user with access to the same link.
For example;
user 1 has access to pages abce
user 2 has access to pages def
the recordset throws out all records that equal user1 but the page "e" is still in the dropdown when user1 refreshes the page cause its also available to user2. Only pages D, and F should be available.
here's the code:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/conntesttsrserv.asp" -->
<%
Dim Recordset1__MMColParam
Recordset1__MMColParam = "1"
If (Request.QueryString("UserID")<> "") Then
Recordset1__MMColParam = Request.QueryString("UserID")
End If
%>
<%
Dim Recordset1
Dim Recordset1_numRows
Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_conntesttsrserv_STRING
Recordset1.Source = "SELECT useraccess.UserID, useraccess.Username, linkdetail.pagelinkIDdetail, pagelinks.pagelinks FROM useraccess INNER JOIN (pagelinks INNER JOIN linkdetail ON pagelinks.pagelinkID = linkdetail.pagelinkIDdetail) ON useraccess.UserID = linkdetail.userID WHERE useraccess.UserID<>" + Replace(Recordset1__MMColParam, "'", "''") + ""
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()
Recordset1_numRows = 0
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
<table width="100%" height="82" border="0">
<tr>
<td><form name="form1" method="post" action="">
<p>
Username
<%=(Recordset1.Fields.Item("Username").Value)%>
</p>
<p> pagelinks
<select name="pagelinkid" id="pagelinkid">
<%
While (NOT Recordset1.EOF)
%>
<option value="<%=(Recordset1.Fields.Item("pagelinkIDdetail").Value)%>"><%=(Recordset1.Fields.Item("pagelinks").Value)%></option>
<%
Recordset1.MoveNext()
Wend
If (Recordset1.CursorType > 0) Then
Recordset1.MoveFirst
Else
Recordset1.Requery
End If
%>
</select>
</p>
<p>
<input type="submit" name="Submit" value="Add pagelink">
</p>
</form></td>
</tr>
</table>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>
Is there any way this could work? Recode or redesign the database?
I thought maybe have two recordsets one that equals the pagelinks and another that doesn't equal the userid and doesn't equal anything in the first recordset, but I can't seem to get that to work.
Any help is greatly appreciated.
Thanks,
Dan