SQL help

M

Mike Mueller

I am using what is probably now considered access database
authentication. I want to take it to the next step, and
pulling the first name from the mdb file and placing that
into a session variable. I would then retrieve that session
variable and personalize the members pages. The problem I
have is that it appears that the session variable for the
name seems to be blank. Here is the sql statement from the
validation page and the retrieval portion from the members
pages.

-----Connection String, validation code, and save to
variables
strSQL1 = "SELECT * FROM Roster WHERE UserName = '" & _
strUserName & "' AND Password = '" & _
strPassword &"'"

Set objConn = Server.CreateObject ("ADODB.Connection")
objConn.Open application ("Database1_ConnectionString")
Set objRS1 = objConn.Execute (strSQL1)

If Not objRS1.EOF Then
strCurrentUser = RecordSet.Fields("First_Name")
Session("bolAuthenticated") = True
Session("strUserName") = strUserName
Session("CurrentUser") = strCurrentUser


-----Retrieve the information and display the name on the
menu page
<html>
<%
Dim CurrentUser
CurrentUser = Session("strCurrentUser")
%>

<head></head>

<body>
<h2 align="center">
Welcome to the Members Menu</h2>
<p align="center">Current User: <%=CurrentUser%>
</p>
<p>&nbsp</p>
Here is the menu
</body></html>
 
K

Kevin Spencer

Possible reasons why the Session variable for the name would be blank:

1. No Records were returned from the Query.
2. The Record returned was blank.
3. You waited longer than the Session Timeout (defaults to 20 min) to
request the second page.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.
 
M

Mike Mueller

Kevin,
Thank you for the response. Here is some more info if this
helps

1-The First_Name column has records in all rows.
2-Apparently this is what is happening, I need to find out
why
3-Immediately following the code I snipped from the
validation page, it redirects to the menu page.

The only thing I can think of is that the problem may be in
the db structure, as First_Name is the first colum, and the
username, password are towards the end

Mike


Kevin Spencer wrote:
: Possible reasons why the Session variable for the name
: would be blank:
:
: 1. No Records were returned from the Query.
: 2. The Record returned was blank.
: 3. You waited longer than the Session Timeout (defaults
: to 20 min) to request the second page.
:
:
: message :: I am using what is probably now considered access
:: database authentication. I want to take it to the next
:: step, and pulling the first name from the mdb file and
:: placing that into a session variable. I would then
:: retrieve that session variable and personalize the
:: members pages. The problem I have is that it appears
:: that the session variable for the name seems to be
:: blank. Here is the sql statement from the validation
:: page and the retrieval portion from the members pages.
::
:: -----Connection String, validation code, and save to
:: variables
:: strSQL1 = "SELECT * FROM Roster WHERE UserName = '" & _
:: strUserName & "' AND Password = '" & _
:: strPassword &"'"
::
:: Set objConn = Server.CreateObject ("ADODB.Connection")
:: objConn.Open application ("Database1_ConnectionString")
:: Set objRS1 = objConn.Execute (strSQL1)
::
:: If Not objRS1.EOF Then
:: strCurrentUser = RecordSet.Fields("First_Name")
:: Session("bolAuthenticated") = True
:: Session("strUserName") = strUserName
:: Session("CurrentUser") = strCurrentUser
::
::
:: -----Retrieve the information and display the name on the
:: menu page
:: <html>
:: <%
:: Dim CurrentUser
:: CurrentUser = Session("strCurrentUser")
:: %>
::
:: <head></head>
::
:: <body>
:: <h2 align="center">
:: Welcome to the Members Menu</h2>
:: <p align="center">Current User: <%=CurrentUser%>
:: </p>
:: <p>&nbsp</p>
:: Here is the menu
:: </body></html>
 
K

Kevin Spencer

I would suggest that, for diagnosis, you use Response.Write in the first
page to find out what your returned value is.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.
 
S

Stefan B Rusynko

And change strCurrentUser = RecordSet.Fields("First_Name")
to strCurrentUser = objRS1("First_Name")





| I would suggest that, for diagnosis, you use Response.Write in the first
| page to find out what your returned value is.
|
| --
| HTH,
| Kevin Spencer
| .Net Developer
| Microsoft MVP
| Neither a follower
| nor a lender be.
|
| | > Kevin,
| > Thank you for the response. Here is some more info if this
| > helps
| >
| > 1-The First_Name column has records in all rows.
| > 2-Apparently this is what is happening, I need to find out
| > why
| > 3-Immediately following the code I snipped from the
| > validation page, it redirects to the menu page.
| >
| > The only thing I can think of is that the problem may be in
| > the db structure, as First_Name is the first colum, and the
| > username, password are towards the end
| >
| > Mike
| >
| >
| > Kevin Spencer wrote:
| > : Possible reasons why the Session variable for the name
| > : would be blank:
| > :
| > : 1. No Records were returned from the Query.
| > : 2. The Record returned was blank.
| > : 3. You waited longer than the Session Timeout (defaults
| > : to 20 min) to request the second page.
| > :
| > :
| > : message | > :: I am using what is probably now considered access
| > :: database authentication. I want to take it to the next
| > :: step, and pulling the first name from the mdb file and
| > :: placing that into a session variable. I would then
| > :: retrieve that session variable and personalize the
| > :: members pages. The problem I have is that it appears
| > :: that the session variable for the name seems to be
| > :: blank. Here is the sql statement from the validation
| > :: page and the retrieval portion from the members pages.
| > ::
| > :: -----Connection String, validation code, and save to
| > :: variables
| > :: strSQL1 = "SELECT * FROM Roster WHERE UserName = '" & _
| > :: strUserName & "' AND Password = '" & _
| > :: strPassword &"'"
| > ::
| > :: Set objConn = Server.CreateObject ("ADODB.Connection")
| > :: objConn.Open application ("Database1_ConnectionString")
| > :: Set objRS1 = objConn.Execute (strSQL1)
| > ::
| > :: If Not objRS1.EOF Then
| > :: strCurrentUser = RecordSet.Fields("First_Name")
| > :: Session("bolAuthenticated") = True
| > :: Session("strUserName") = strUserName
| > :: Session("CurrentUser") = strCurrentUser
| > ::
| > ::
| > :: -----Retrieve the information and display the name on the
| > :: menu page
| > :: <html>
| > :: <%
| > :: Dim CurrentUser
| > :: CurrentUser = Session("strCurrentUser")
| > :: %>
| > ::
| > :: <head></head>
| > ::
| > :: <body>
| > :: <h2 align="center">
| > :: Welcome to the Members Menu</h2>
| > :: <p align="center">Current User: <%=CurrentUser%>
| > :: </p>
| > :: <p>&nbsp</p>
| > :: Here is the menu
| > :: </body></html>
| >
| >
|
|
 
M

Mike Mueller

Stefan- that was it.


: And change strCurrentUser =
RecordSet.Fields("First_Name")
: to strCurrentUser = objRS1("First_Name")
:
:
: --
:
: _____________________________________________
: SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
: "Warning - Using the F1 Key will not break anything!" (-;
: To find the best Newsgroup for FrontPage support see:
: http://www.net-sites.com/sitebuilder/newsgroups.asp
: _____________________________________________
:
:
: | I would suggest that, for diagnosis, you use
Response.Write in the first
: | page to find out what your returned value is.
: |
: | --
: | HTH,
: | Kevin Spencer
: | .Net Developer
: | Microsoft MVP
: | Neither a follower
: | nor a lender be.
: |
message
: | : | > Kevin,
: | > Thank you for the response. Here is some more info if
this
: | > helps
: | >
: | > 1-The First_Name column has records in all rows.
: | > 2-Apparently this is what is happening, I need to find
out
: | > why
: | > 3-Immediately following the code I snipped from the
: | > validation page, it redirects to the menu page.
: | >
: | > The only thing I can think of is that the problem may
be in
: | > the db structure, as First_Name is the first colum,
and the
: | > username, password are towards the end
: | >
: | > Mike
: | >
: | >
: | > Kevin Spencer wrote:
: | > : Possible reasons why the Session variable for the
name
: | > : would be blank:
: | > :
: | > : 1. No Records were returned from the Query.
: | > : 2. The Record returned was blank.
: | > : 3. You waited longer than the Session Timeout
(defaults
: | > : to 20 min) to request the second page.
: | > :
: | > :
: | > : message
: | > :: I am using what is probably now considered access
: | > :: database authentication. I want to take it to the
next
: | > :: step, and pulling the first name from the mdb file
and
: | > :: placing that into a session variable. I would then
: | > :: retrieve that session variable and personalize the
: | > :: members pages. The problem I have is that it
appears
: | > :: that the session variable for the name seems to be
: | > :: blank. Here is the sql statement from the
validation
: | > :: page and the retrieval portion from the members
pages.
: | > ::
: | > :: -----Connection String, validation code, and save
to
: | > :: variables
: | > :: strSQL1 = "SELECT * FROM Roster WHERE UserName = '"
& _
: | > :: strUserName & "' AND Password = '" & _
: | > :: strPassword &"'"
: | > ::
: | > :: Set objConn = Server.CreateObject
("ADODB.Connection")
: | > :: objConn.Open application
("Database1_ConnectionString")
: | > :: Set objRS1 = objConn.Execute (strSQL1)
: | > ::
: | > :: If Not objRS1.EOF Then
: | > :: strCurrentUser = RecordSet.Fields("First_Name")
: | > :: Session("bolAuthenticated") = True
: | > :: Session("strUserName") = strUserName
: | > :: Session("CurrentUser") = strCurrentUser
: | > ::
: | > ::
: | > :: -----Retrieve the information and display the name
on the
: | > :: menu page
: | > :: <html>
: | > :: <%
: | > :: Dim CurrentUser
: | > :: CurrentUser = Session("strCurrentUser")
: | > :: %>
: | > ::
: | > :: <head></head>
: | > ::
: | > :: <body>
: | > :: <h2 align="center">
: | > :: Welcome to the Members Menu</h2>
: | > :: <p align="center">Current User: <%=CurrentUser%>
: | > :: </p>
: | > :: <p>&nbsp</p>
: | > :: Here is the menu
: | > :: </body></html>
: | >
: | >
: |
: |
:
:
 
M

Mike Mueller

Between the 2 of them and viewing several articles written
by them on the web I have found the errors I had created
 
K

Kevin Spencer

Man, how did I miss that!

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.
 
K

Kevin Spencer

Thank YOU, Mike! :)

--
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top