ASP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingASP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #16  
Old October 19th, 2009, 08:45 AM
mind_grapes mind_grapes is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2009
Location: Midlands
Posts: 258 mind_grapes User rank is Corporal (100 - 500 Reputation Level)mind_grapes User rank is Corporal (100 - 500 Reputation Level)mind_grapes User rank is Corporal (100 - 500 Reputation Level)mind_grapes User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 2 Days 11 h 7 m 55 sec
Reputation Power: 2
Hello Shadow,

I have a few questions. Do i need to do anything with the strURL= ""? I don't need to include a URL do I?

Also, I'm guessing that strUserName = oRS("username") and strDeptName = oRS("DeptName"), are linked to the database based on names ? I feel I should apologise for the lack of knowledge.

Regards
MG

Reply With Quote
  #17  
Old October 20th, 2009, 07:01 AM
mind_grapes mind_grapes is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2009
Location: Midlands
Posts: 258 mind_grapes User rank is Corporal (100 - 500 Reputation Level)mind_grapes User rank is Corporal (100 - 500 Reputation Level)mind_grapes User rank is Corporal (100 - 500 Reputation Level)mind_grapes User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 2 Days 11 h 7 m 55 sec
Reputation Power: 2
Hi Shadow, for some reason the following error message appears, but i cant understand why this might be?

Microsoft OLE DB Provider for SQL Server (0x80040E10)
Procedure or function 'spGetUserDetailsByID' expects parameter '@iUserID', which was not supplied.
C:\INETPUB\WWWROOT\INTRANET\ADMIN\STORES\../../i/security.asp, line 103

line 103 is highlighted in red

Code:
sSQL = "exec spGetUserDetailsByID " & iuserID
SET oRS = oDB.Execute(sSQL)
strUserName = oRS("username")
strDeptName = oRS("departmentName")
strURL = ""
If strDeptName="IT" And strUserName="Joe bloggs" Then
   strURL = "page1.asp"
ElseIf strDeptName="IT" And strUserName="Brian bloggs" Then
   strURL = "page2.asp"
ElseIf strDeptName="IT" And strUserName="Claire bloggs" Then
   strURL = "page3.asp"
End If
oRS.Close
If Len(strURL)>0 Then
   Response.Redirect(strURL)
End If


Im sure im doing the same as the other parts of my code

Kind regards
MG



Quote:
Originally Posted by Shadow Wizard
correct syntax would be:
Code:
Dim strUserName, strDeptName, strURL
sSQL = "exec spGetUserDetailsByID " & iuserID
SET oRS = oDB.Execute(sSQL)
strUserName = oRS("username")
strDeptName = oRS("departmentName")
strURL = ""
If strDeptName="IT" And strUserName="Joe bloggs" Then
   strURL = "page1.asp"
ElseIf strDeptName="IT" And strUserName="Brian bloggs" Then
   strURL = "page2.asp"
ElseIf strDeptName="IT" And strUserName="Claire bloggs" Then
   strURL = "page3.asp"
End If
oRS.Close
If Len(strURL)>0 Then
   Response.Redirect(strURL)
End If

this will check the user name and the department and redirect based on their value.

Reply With Quote
  #18  
Old October 20th, 2009, 08:10 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
Click here for more information
 
Join Date: Sep 2004
Location: Israel
Posts: 29,262 Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)  Folding Points: 587728 Folding Title: Super Ultimate Folder - Level 2Folding Points: 587728 Folding Title: Super Ultimate Folder - Level 2Folding Points: 587728 Folding Title: Super Ultimate Folder - Level 2Folding Points: 587728 Folding Title: Super Ultimate Folder - Level 2Folding Points: 587728 Folding Title: Super Ultimate Folder - Level 2Folding Points: 587728 Folding Title: Super Ultimate Folder - Level 2Folding Points: 587728 Folding Title: Super Ultimate Folder - Level 2
Time spent in forums: 3 Months 2 Weeks 2 Days 32 m 33 sec
Reputation Power: 2509
Quote:
Originally Posted by mind_grapes
Hello Shadow,

I have a few questions. Do i need to do anything with the strURL= ""? I don't need to include a URL do I?

Also, I'm guessing that strUserName = oRS("username") and strDeptName = oRS("DeptName"), are linked to the database based on names ? I feel I should apologise for the lack of knowledge.

Regards
MG
the strURL is local variable that get populated based on the conditions in the code.

oRS("username") and oRS("DeptName") will both give you value from your database,
and that in the code is being stored inside something known as Recordset, which is
what executing Stored Procedure returns.

regarding that error, change those two lines:
Code:
sSQL = "exec spGetUserDetailsByID " & iuserID
SET oRS = oDB.Execute(sSQL)

to this instead:
Code:
sSQL = "exec spGetUserDetailsByID " & iuserID
Response.Write("sql: " & sSQL & "<br />")
Response.END()
SET oRS = oDB.Execute(sSQL)

and post here what you get. (need to debug and see the SQL being executed)

Reply With Quote
  #19  
Old October 20th, 2009, 08:43 AM
mind_grapes mind_grapes is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2009
Location: Midlands
Posts: 258 mind_grapes User rank is Corporal (100 - 500 Reputation Level)mind_grapes User rank is Corporal (100 - 500 Reputation Level)mind_grapes User rank is Corporal (100 - 500 Reputation Level)mind_grapes User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 2 Days 11 h 7 m 55 sec
Reputation Power: 2
Hello,

Ok, so i did what you asked and i get the following returned, with my name at the front:

Mind_grapes sql: exec spGetUserDetailsByID

Hope this is helpful?

Kind regards
MG

Last edited by mind_grapes : October 20th, 2009 at 08:50 AM.

Reply With Quote
  #20  
Old October 20th, 2009, 09:04 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
Click here for more information
 
Join Date: Sep 2004
Location: Israel
Posts: 29,262 Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)  Folding Points: 587728 Folding Title: Super Ultimate Folder - Level 2Folding Points: 587728 Folding Title: Super Ultimate Folder - Level 2Folding Points: 587728 Folding Title: Super Ultimate Folder - Level 2Folding Points: 587728 Folding Title: Super Ultimate Folder - Level 2Folding Points: 587728 Folding Title: Super Ultimate Folder - Level 2Folding Points: 587728 Folding Title: Super Ultimate Folder - Level 2Folding Points: 587728 Folding Title: Super Ultimate Folder - Level 2
Time spent in forums: 3 Months 2 Weeks 2 Days 32 m 33 sec
Reputation Power: 2509
it means you do not supply any user ID.

in post #13 you have code with variable called "iuserID", I assumed
you already have there valid ID of some user.

I see now that I was wrong.

what is this code? just some code you copied from somewhere?

anyhow, that variable must contain valid ID of user, for exampe
if you will add this line to your code:
Code:
iuserID = 3

it will assign value of 3 to the variable, then the value 3 will be
passed to your stored procedure, that will go and look for user
with that ID. (meaning record from the table tblUsers where the
field userID has value of 3)

Sorry for the confusion, sometimes I assume too much.

Reply With Quote
  #21  
Old October 20th, 2009, 10:27 AM
mind_grapes mind_grapes is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2009
Location: Midlands
Posts: 258 mind_grapes User rank is Corporal (100 - 500 Reputation Level)mind_grapes User rank is Corporal (100 - 500 Reputation Level)mind_grapes User rank is Corporal (100 - 500 Reputation Level)mind_grapes User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 2 Days 11 h 7 m 55 sec
Reputation Power: 2
Hello Shadow, thank you for the reply.

I think its my fault. If you have assumed something its probably because i have not included nor supplied the correct information you need. So it is my fault for not being clear, i apologise for that.

I have just checked post 13 and can see to what you are referring. You're right i need to get the users ID first and then assign that value to pass to the stored procedure. But I just don't know how to do this.

I had this code to get the persons name:
Code:
userNameTest = Mid(request.ServerVariables("AUTH_USER"), InStr(request.ServerVariables("AUTH_USER"), "\")+1)
response.write(userNameTest & " ")


But I'm guessing this is not the best way to go about doing this?

I did try to get a stored procedure to return the users ID and assign it to a variable, but i couldnt get it to work, so then tried to use the person name. Once I had done all that it brought me here, to this point, trying to redirect people.

The userID is held in a database against names dept etc.

is this possible?:

Code:
 
iUserID = <%=Session("LOGGED_ON_USER_ARRAY")(4) %>


To get the users ID

Regards
MG

Reply With Quote
  #22  
Old October 20th, 2009, 10:48 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
Click here for more information
 
Join Date: Sep 2004
Location: Israel
Posts: 29,262 Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)  Folding Points: 587728 Folding Title: Super Ultimate Folder - Level 2Folding Points: 587728 Folding Title: Super Ultimate Folder - Level 2Folding Points: 587728 Folding Title: Super Ultimate Folder - Level 2Folding Points: 587728 Folding Title: Super Ultimate Folder - Level 2Folding Points: 587728 Folding Title: Super Ultimate Folder - Level 2Folding Points: 587728 Folding Title: Super Ultimate Folder - Level 2Folding Points: 587728 Folding Title: Super Ultimate Folder - Level 2
Time spent in forums: 3 Months 2 Weeks 2 Days 32 m 33 sec
Reputation Power: 2509
sorry, but you need to decide how to take user ID.

the ServerVariables("AUTH_USER") hold the account name, not ID
so that won't help you.

if you already have the ID in ession("LOGGED_ON_USER_ARRAY") then
yes, it would work. but correct ASP syntax is:
Code:
<%
iUserID = Session("LOGGED_ON_USER_ARRAY")(4)
%>

I see you lack the most basic knowledge in the ASP syntax,
maybe you better learn those basics from books or online
tutorials like w3schools - when you have better grasp of things
like ASP delimeters, ASP variables and the basic syntax you
will find it easier to write "real" ASP code.

Reply With Quote
  #23  
Old October 23rd, 2009, 05:45 AM
mind_grapes mind_grapes is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2009
Location: Midlands
Posts: 258 mind_grapes User rank is Corporal (100 - 500 Reputation Level)mind_grapes User rank is Corporal (100 - 500 Reputation Level)mind_grapes User rank is Corporal (100 - 500 Reputation Level)mind_grapes User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 2 Days 11 h 7 m 55 sec
Reputation Power: 2
Hi Shadow, sorry for the slow reply i've not been at work due to an illness, back back now.

Thanks for the info. I believe my manager had set that already, i think its in the global.asa file. the code is

Code:
sub Application_OnStart
' Application("CONN_STRING") = "Driver={SQLServer};Server=ITFolder;Database=intran  et; Uid=INTRANET;Pwd=pswrd;"
   Application("DEFAULT_URL") = "http://localhost"
  Application("CURRENT_USERS") = 0
  Application("ADMIN_MESSAGE") = 0
  SET Application("oDBConn") = Server.CreateObject("ADODB.Connection")
  Application("oDBConn").open(Application("CONN_STRING"))
end sub


sub Application_OnEnd
  'some code
end sub


sub Session_OnStart
  Session("TEST_VARIABLE") = ""
  Session("DEBUG_MODE_ON") = False
  Session("LOGGED_ON_USER_ARRAY") = Split(Request.ServerVariables("LOGON_USER"), "\")
  
  'this was done by me (psk) when tyring to create the security settings.
  'Security Levels
  'Session("AccessLevel") = oRS ("UserAccessLevel")
  'Session ("nAccessLevel") = CLng(Session("LOGGED_ON_USER_ARRAY").Fields("UserAccessLevel").Value)
  
  SET Session("LOGGED_ON_USER_ARRAY") = Application("oDBConn").Execute("EXEC spGetUserDetails '" & Right(Request.ServerVariables("LOGON_USER"), LEN(Request.ServerVariables("LOGON_USER")) - INSTR(Request.ServerVariables("LOGON_USER"),"\")) & "'")
  
  Application("CURRENT_USERS") = Application("CURRENT_USERS") + 1
end sub

sub Session_OnEnd
  Application("CURRENT_USERS") = Application("CURRENT_USERS") - 1
  'some code
end sub


Have I read it right?

I admit im not the best, i do know little things but seem to forget them all the time, still sturggling i guess. i think you're right its best i go over the basics again because i do feel so rusty. Sorry once again.

Kind regards
MG

Last edited by mind_grapes : October 23rd, 2009 at 05:47 AM.

Reply With Quote
  #24  
Old October 23rd, 2009, 08:30 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
Click here for more information
 
Join Date: Sep 2004
Location: Israel
Posts: 29,262 Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)  Folding Points: 587728 Folding Title: Super Ultimate Folder - Level 2Folding Points: 587728 Folding Title: Super Ultimate Folder - Level 2Folding Points: 587728 Folding Title: Super Ultimate Folder - Level 2Folding Points: 587728 Folding Title: Super Ultimate Folder - Level 2Folding Points: 587728 Folding Title: Super Ultimate Folder - Level 2Folding Points: 587728 Folding Title: Super Ultimate Folder - Level 2Folding Points: 587728 Folding Title: Super Ultimate Folder - Level 2
Time spent in forums: 3 Months 2 Weeks 2 Days 32 m 33 sec
Reputation Power: 2509
that's OK mate, you don't have to apologize.

anyhow that session variable indeed hold what you need.
to know once and for all, please have the following code in your page:
Code:
<%
Dim oUserRS, x
Set oUserRS = Session("LOGGED_ON_USER_ARRAY")
For x=0 To oUserRS.Fields.Count-1
   Response.Write("field name: " & oUserRS.Fields(x).Name & ", value: " & oUserRS(x) & "<br />")
Next
%>

what is the output of this code? once you know I believe this thread can
finally come to final peace and solution.
Comments on this post
mind_grapes agrees: many thanks

Reply With Quote
  #25  
Old October 26th, 2009, 03:47 AM
mind_grapes mind_grapes is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2009
Location: Midlands
Posts: 258 mind_grapes User rank is Corporal (100 - 500 Reputation Level)mind_grapes User rank is Corporal (100 - 500 Reputation Level)mind_grapes User rank is Corporal (100 - 500 Reputation Level)mind_grapes User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 2 Days 11 h 7 m 55 sec
Reputation Power: 2
Hello Shadow, thank you for the reply.

I shall add this to the security.asp page and post back what i can see.

Kind regards
MG

Reply With Quote
  #26  
Old October 26th, 2009, 06:38 AM
mind_grapes mind_grapes is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2009
Location: Midlands
Posts: 258 mind_grapes User rank is Corporal (100 - 500 Reputation Level)mind_grapes User rank is Corporal (100 - 500 Reputation Level)mind_grapes User rank is Corporal (100 - 500 Reputation Level)mind_grapes User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 2 Days 11 h 7 m 55 sec
Reputation Power: 2
Hi shadow,

This line of code did bring back the UserID, so that was good.

Code:
iuserID = Session("LOGGED_ON_USER_ARRAY")(4)


The lines of code you asked me to include brought this information back:

field name: departmentName, value: Business Systems
field name: username, value: Mind_grapes
field name: , value: Mind_grapes
field name: FolderName, value: BUSSYS
field name: userID, value: 2
field name: departmentID, value: 1
field name: StoreID, value:

Brilliant, this is all the data that is currently in the database, thats good news right

Regards
MG

Last edited by mind_grapes : October 26th, 2009 at 10:40 AM.

Reply With Quote
  #27  
Old October 28th, 2009, 07:01 AM
mind_grapes mind_grapes is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2009
Location: Midlands
Posts: 258 mind_grapes User rank is Corporal (100 - 500 Reputation Level)mind_grapes User rank is Corporal (100 - 500 Reputation Level)mind_grapes User rank is Corporal (100 - 500 Reputation Level)mind_grapes User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 2 Days 11 h 7 m 55 sec
Reputation Power: 2
Hi Shadow, I just thought I'd update you on what I've been doing.

I have been playing around with the code and going back over what you've suggested on this topic. It seems to be working now, so thank you for that.

I have added extra tables and columns to the Stored Procedure so I now need to work on the new data too, and incorporate these feilds when redirecting people to the correct pages. But with what you have recommended I think it should all work out. Will check back later once done.

Thank you for everything you have done. Its appreciated a great deal and a massive help in my learning.

Kind regards
MG

Reply With Quote
  #28  
Old October 28th, 2009, 04:56 PM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
Click here for more information
 
Join Date: Sep 2004
Location: Israel
Posts: 29,262 Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)  Folding Points: 587728 Folding Title: Super Ultimate Folder - Level 2Folding Points: 587728 Folding Title: Super Ultimate Folder - Level 2Folding Points: 587728 Folding Title: Super Ultimate Folder - Level 2Folding Points: 587728 Folding Title: Super Ultimate Folder - Level 2Folding Points: 587728 Folding Title: Super Ultimate Folder - Level 2Folding Points: 587728 Folding Title: Super Ultimate Folder - Level 2Folding Points: 587728 Folding Title: Super Ultimate Folder - Level 2
Time spent in forums: 3 Months 2 Weeks 2 Days 32 m 33 sec
Reputation Power: 2509
no problem MG, I'm really glad I could help.

one little suggestion though, in your code change this one:
Code:
Session("LOGGED_ON_USER_ARRAY")(4)

to this instead:
Code:
Session("LOGGED_ON_USER_ARRAY")("userID")

the reason is that when you give number, you rely on the field to always
be in that specific index... if you change the SQL statement bringing this
field back the index might change and the code will break. when using the
field name it doesn't matter where it appears in the SQL statement, it will
always find it - more safe, less room for future problems.

Reply With Quote
  #29  
Old October 29th, 2009, 09:49 AM
mind_grapes mind_grapes is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2009
Location: Midlands
Posts: 258 mind_grapes User rank is Corporal (100 - 500 Reputation Level)mind_grapes User rank is Corporal (100 - 500 Reputation Level)mind_grapes User rank is Corporal (100 - 500 Reputation Level)mind_grapes User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 2 Days 11 h 7 m 55 sec
Reputation Power: 2
Hi Shadow, thanks for the reply.

I will update as you have suggested, thank you once again.

I've been playing around with the code and also going over some VBScript tutorials, will go over ASP again soon too.

My updated Stored Procedure now looks like this:

Code:
SELECT 
			 storeNumber
			,storeName
			,userID
			,username
			,FirstName + ' ' + LastName 
			,departmentID
			,departmentName
			,FolderName 
			,roleID
			,roleName
			,levelID
			,levelName
			,levelCode
			,fk_storeID as StoreID

		FROM tblUsers u
			LEFT JOIN tblUser2Dept AS u2d 
				on u.userID = u2d.fk_userID
			LEFT JOIN tblDepartment AS d 
				on u2d.fk_deptID = d.departmentID
			LEFT JOIN tblUser2Store AS u2s 
				on userID = u2s.fk_userID
			LEFT JOIN tblUser2Role AS u2r
				on u.userID = u2r.fk_userID
			LEFT JOIN tblRoles AS r 
				on u2r.fk_roleID = r.roleID
			LEFT JOIN tblStores AS s
				on u2s.fk_storeID = s.storeID
			LEFT JOIN tblSA2AccessLevels AS sa2al
				on r.roleID = sa2al.fk_roleID 
					AND d.departmentID = sa2al.fk_deptID
			LEFT JOIN tblLevels AS l
				on l.levelID = sa2al.fk_levelID

		WHERE userID = @iUserID
END


And I have added to your code and it now looks like this:

Code:
strStoreID = oRS("StoreID")			
strStoreNumber = oRS("storeNumber")			
strStoreName = oRS("storeName")
strUserName = oRS("username")
'strFullName = oRS("FirstName + ' ' + LastName")
strDepartmentID = oRS("departmentID")
strDeptName = oRS("departmentName")
strFolderName = oRS("FolderName")
strRoleID = oRS("roleID")
strRoleName = oRS("roleName")
strLevelID = oRS("levelID")
strLevelName = oRS("levelName")
strLevelCode = oRS("levelCode")
strURL = ""


I would guess this is right as the link to the database is made and the variables are being assigned to a column header?
With the VBscript amended all should be done with the rediretcing of people to the correct pages.


Kind regards
MG

Quote:
Originally Posted by Shadow Wizard
no problem MG, I'm really glad I could help.

one little suggestion though, in your code change this one:
Code:
Session("LOGGED_ON_USER_ARRAY")(4)

to this instead:
Code:
Session("LOGGED_ON_USER_ARRAY")("userID")

the reason is that when you give number, you rely on the field to always
be in that specific index... if you change the SQL statement bringing this
field back the index might change and the code will break. when using the
field name it doesn't matter where it appears in the SQL statement, it will
always find it - more safe, less room for future problems.

Last edited by mind_grapes : October 29th, 2009 at 09:53 AM.

Reply With Quote
  #30  
Old October 29th, 2009, 09:57 AM
mind_grapes mind_grapes is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2009
Location: Midlands
Posts: 258 mind_grapes User rank is Corporal (100 - 500 Reputation Level)mind_grapes User rank is Corporal (100 - 500 Reputation Level)mind_grapes User rank is Corporal (100 - 500 Reputation Level)mind_grapes User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 2 Days 11 h 7 m 55 sec
Reputation Power: 2
Hi Shadow,

Sorry, meant to ask, do you mean to change it where i set the userID, or in the main section where session is defined?

Regards
MG

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingASP Development > VBScript - Database - General - Can you assign the select result of a stored procedure as a value?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump





 Free IT White Papers!
 
Create the Optimal Architecture for your Critical Applications
Warburton's the largest independently owned bakery in the UK faced a number of difficult challenges in providing the most robust yet efficient IT infrastructure for their organization's success. IBM's services combined with their xSeries servers created the perfect platform for their SAP environment with sufficient flexibility, and did so in very time effective fashion.

 
Five Best Practices for Deploying a Successful Service-Oriented Architecture
This white paper describes the benefits you can expect with SOA, and how IBM can help take your business there.

 
Gartner Magic Quadrant for Application Delivery Controllers
Gartner summarizes its view on Application Delivery Controllers, evaluates strengths and weaknesses of solutions, and provides Magic Quadrant reporting for a quick comparison across all vendors. Learn from Gartner how you can benefit from an all-in-one device like Citrix NetScaler that delivers the highest levels of availability, performance and security.

 
Knowledge is Power
What you don't know can hurt you, and is likely costing you money and increasing your security risks during an era of scarce resources. This white paper proposes six key strategies that enterprise security managers can use to improve their network defense posture.

 
Rationalizing the Multi-Tool Environment
The rationalized multi-tool approach is flexible, scalable and cost effective. It provides the necessary input to the IT service management business processes. It preserves prior investments in monitoring tools, empowers technologists to select the best tools with which to do their jobs, and enhances effective response to incidents.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2010 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek