Grab Session Variable with SPROC or code? -
03-26-2009
, 10:24 AM
Hi, Am using Dreamweaver MX to creat database driven site with
SQL2005. When my users authenticate it sends their userid [SLUserID]
so it can be grabbed throughtout the site. As an example I have
created a testdb.asp page, connected to SQL2005 database, created a
session variable named SL_UserID. If I drag that session variable to
the DW asp page it does indeed display the ID number on the asp page.
What I am trying to do is grab this variable on an asp page which
display customer records so it filters just the logged in users data.
However I have trouble when I do the following tasks:
Created a sql recordset, runs fine but doesnt like SL_UserID as
variable
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
<!--#include file="../Connections/GHLDNS.asp" -->
<%
var rsSQLCODE = Server.CreateObject("ADODB.Recordset");
rsSQLCODE.ActiveConnection = MM_GHLDNS_STRING;
rsSQLCODE.Source = "SELECT SLUsers.D2Custom1, SLUsers.D2ID,
TblCommissionPayment.Provider, TblCommissionPayment.PaymentID,
TblCommissionPayment.OWPaidDate,
TblCommissionPayment.ClientName, TblCommissionPayment.PolicyNumber,
TblCommissionPayment.ProductType,
TblCommissionPayment.CaseID,
TblCommissionPayment.CommissionPaid, SLUsers.D2Username,
SLUsers.D2EmailAddress, SLUsers.D2Surname, SLUsers.D2FirstName FROM
TblCommissionPayment INNER JOIN SLUsers ON
TblCommissionPayment.CRID COLLATE SQL_Latin1_General_CP1_CI_AS =
SLUsers.D2Custom1 WHERE D2ID=Session.SLUsers.D2ID";
%>
Errors as such -
[Microsoft][SQL Server Native Client 10.0][SQL Server]The multi-part
identifier "Session.SLUsers.D2ID" could not be bound.
/sitefolder/userdetails.asp, line 10
If I take the session part out to leave SL_Users.D2ID it runs but does
not filter by ID!
Secondly I created a recordset connected to a stored procedure data
displays but cant locate where to assign the session variable to
sproc!
<%
var rsSproc = Server.CreateObject("ADODB.Recordset");
rsSproc.ActiveConnection = MM_GHLDNS_STRING;
rsSproc.Source = "{call dbo.usp_usercommissionform}";
rsSproc.CursorType = 0;
rsSproc.CursorLocation = 2;
rsSproc.LockType = 1;
rsSproc.Open();
var rsSproc_numRows = 0;
%>
I am now offically lost in code!! Any ideas how I can grab the
SL_UserID inside dreamweaver to filter records?
Thanx |