Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 20th, 2005, 09:24 AM
Registered User
 
Join Date: Feb 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default add this select statement to this asp

<%
Dim strUsername
Dim Pwd

strUsername = Request.form("uname")
Pwd = Request.form("pword")

MyPath=Server.MapPath("database.mdb")
Set conn = Server.CreateObject("ADODB.Connection")

conn.Open "Driver={Microsoft Access Driver (*.mdb)};" & _
"DBQ=" & MyPath

query = "SELECT * FROM users WHERE username='"& strUsername &"' AND password='"& Pwd &"'"
set rs = conn.Execute (query)

if rs.eof then
response.write("&answer=failed")
else
Session("member") = rs("Id")
Session.Timeout = 20
response.write "answer=ok&"
end if
'close recordset
rs.close

set conn = nothing
set rs = nothing
%>


in this code, which successfully checks the username and password, how would it look with this statement in it..


SELECT * FROM users WHERE username = " & Request("uName")


basically this code called from Macromedia flash, and it successfully checks whether or not the login details are in my database.
what i want it to do is set up a session, so the user can log in... and dependin on wat they entered in the uname input box.. which they logged in from, it only loads their details.



 
Old February 20th, 2005, 10:00 AM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 303
Thanks: 0
Thanked 0 Times in 0 Posts
Default

OK, set up a session variable
Session("UserOK") = "Yes"

if rs.eof then
  response.write("&answer=failed")
else
 Session("member") = rs("Id")
 Session("UserOK") = "Yes"
 Session.Timeout = 20
 response.write "answer=ok&"
end if

on the page check whether session variable exists or not

IF Session("UserOK") = "Yes" Then
 'Display user specific information
End IF


 
Old February 20th, 2005, 11:51 AM
Registered User
 
Join Date: Feb 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

would anyone know how to do that in flash actionscript






Similar Threads
Thread Thread Starter Forum Replies Last Post
SELECT statement in ASP please help jennypretty Classic ASP Basics 15 December 3rd, 2008 01:03 AM
Select statement.. help please sarah lee SQL Server 2000 4 May 16th, 2007 09:13 AM
Select from another select statement to a repeater simsen ASP.NET 2.0 Professional 0 May 2nd, 2007 04:34 PM
problem in select statement in ASP-ACCESS s.abraham ASP.NET 1.0 and 1.1 Basics 2 March 24th, 2005 02:31 PM
ASP sql select statement scorpio Classic ASP Databases 5 July 30th, 2003 06:48 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.