WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Webmaster, IT and Security Discussion > Database Discussion Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox Mark Forums Read

Database Discussion Forum This is the place to find help resolving those nagging questions you have about implementing and using all kinds of databases. Need help writing a query? Need an opinion on Oracle? Post here!

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-06-2004, 02:13 PM
seto_kaiba's Avatar
seto_kaiba seto_kaiba is offline
WebProWorld Member
 

Join Date: Dec 2003
Location: Houston
Posts: 33
seto_kaiba RepRank 0
Default ASP & ACCESS

Can sombody please help me?? I now realize that perhaps it would have been easier to use PHP to do this, however I do not really have the time to start over now. I am trying to create a user logon to protect some of the pages on a clients website using ACCESS and ASP Scripting and am having alot of problems with my scripting.

Here is the code I am attempting to use:
<%

Dim adoCon
Dim strSQL
Dim rslogin
Dim strCon
Dim DbasePath

DbasePath = "fpdb/user_login.mdb"

strCon = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & DbasePath

Set adoCon = Server.CreateObject("ADODB.Connection")

adoCon.ConnectionString = strCon

adoCon.Open

Dim GetUsername
Dim GetPassword
Dim GetAccess

Set rsLogin = Server.CreateObject("ADODB.Recordset")

GetUsername = Request.Form("usernamebox")
GetPassword = Request.Form("passwordbox")
If GetUsername <> "" AND GetPassword <> "" Then
strSQL = "SELECT * FROM tblLogin WHERE username = '" & GetUsername & "' AND password = '" & GetPassword & "'"
rsLogin.open strSQL, adoCon
If not rsLogin.EOF Then
GetAccess = rsLogin("accesslevel")
Session("AccessLevel") = GetAccess
Response.Redirect("practice_001.htm")
Else
Response.Redirect("access_denied.htm")
End If
Else
Response.Redirect("access_denied.htm")
End If

%>

The problem that keeps on occuring involes actually being able to find and pull information from the ACCESS Database though the asp code.

Can someone please point me in the right direction?

Thanks a bunch!!
Reply With Quote
  #2 (permalink)  
Old 02-09-2004, 02:50 PM
ronbaker1 ronbaker1 is offline
WebProWorld New Member
 

Join Date: Sep 2003
Location: Hilton Head Island, SC
Posts: 21
ronbaker1 RepRank 0
Default

I use ASP and Access on my web sites - so, I should be able to help. What is the specific error message you're getting.
Reply With Quote
  #3 (permalink)  
Old 02-09-2004, 03:33 PM
freddieb freddieb is offline
WebProWorld Pro
 

Join Date: Jul 2003
Location: NSW Australia
Posts: 174
freddieb RepRank 0
Default Access & ASp

Can I suggest that you go to http://www.aspin.comand download one of the free p/w protection scripts. It's the easiest way!
Reply With Quote
  #4 (permalink)  
Old 02-09-2004, 03:44 PM
deltatrend deltatrend is offline
WebProWorld Member
 

Join Date: Dec 2003
Location: Belgium
Posts: 40
deltatrend RepRank 0
Default ASP/Access login

I do a lot of ASP with Access. The problem is not immediately obvious.

In fact, for my logins I use the Spooky Login http://www.outfront.net. You get a lot of functionality for not much money.
__________________
DavidS

International Relocation Technology
Reply With Quote
  #5 (permalink)  
Old 02-09-2004, 04:02 PM
ronbaker1 ronbaker1 is offline
WebProWorld New Member
 

Join Date: Sep 2003
Location: Hilton Head Island, SC
Posts: 21
ronbaker1 RepRank 0
Default

Here are a couple of observations after a short review of your code.

The database path must be a complete physical path. If you don't know the physical path, use "Server.MapPath" to get it. The path you're using doesn't have the drive identifier, and it looks like a relative path to me - not a physical path.

You didn't show the code to close the recordset and connection and free up those resources. Hopefully this code is at another location on the page. If not, you will use up all of the connections in your connection pool. After that point, you will not be able to get a new connection until the connection resources have been scavenged by a garbabe collector or the web application has been restarted.

Here is how you should free those resources.

objRS.Close
Set objRS = Nothing
objConn.Close
Set objConn = Nothing

If you need it, I can send you a listing of my logon processing (ASP + Access) as a recipe for your coding.
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Database Discussion Forum
Tags: access, asp



Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On



Search Engine Friendly URLs by vBSEO 3.0.0