Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
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 August 5th, 2003, 10:39 PM
Registered User
 
Join Date: Aug 2003
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default database authentication

hi,

i have created a COM component that checks user name and password
entered by the user against a login table with field (ID,PASSWORD)
In my ASP application i call this COM compoenet and pass the
user name and password entered by the user as arguments to
the COM component. but i get an error

Error Type:
FHWA (0x800A01A8)
Object required
/login.asp, line 33



below is the code for my ASP file and Active-X component.. would appreciate if any body can help me out ..

thanks..


<% Option Explicit%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY bgColor=bisque>
<P style="BACKGROUND-COLOR: powderblue">

<STRONG> </STRONG>&nbsp;</P>
<P
style="BACKGROUND-COLOR: bisque"><STRONG>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;
User Name&nbsp;</STRONG>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :&nbsp;
<INPUT style="WIDTH: 91px; HEIGHT: 22px" size=10 id=text1 name=UserID> </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<STRONG>&nbsp;Password&nbsp;</STRONG>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp; : &nbsp;
<INPUT id=text1 name=passWD style="WIDTH: 92px; HEIGHT: 22px" size=11>
</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&nbsp;<INPUT style="WIDTH: 82px; HEIGHT: 24px" type=reset size=31 value=Reset>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;
&nbsp;<INPUT style="WIDTH: 81px; HEIGHT: 24px" type=submit size=25 value=Submit></P>
<P>&nbsp;</P>

<%
Dim sd
Dim user
Dim pwd

' creating instance of our COM component
user= Request("UserID")
pwd= Request("passWD")

set sd= server.createObject("FHWA.Connect")
Response.write "THE COM OBJECT IS : "& sd.Connect(user,pwd)
set sd = nothing

%>


</BODY>
</html>


Active-X dll component is shown below
-------------------------------------

Public Function Connect(UserName As String, Password As String)

Dim UID As String
Dim PWD As String

Dim cn
Dim strSQL
Dim conStr
Dim rs
Dim flag As Boolean


UID = UserName
passwd = Password

conStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\login.mdb"

Set cn = Server.CreateObject("ADODB.Connection")
Set rs = Server.CreateObject("ADODB.Recordset")

cn.open conStr

strSQL = "SELECT PWD FROM LOGIN where UN = " & UID
Set rs = cn.Execute(strSQL)

If rs.EOF = False Then

  If PWD = passwd Then

    flag = True

  End If

Else

 flag = False

End If

rs.Close
cn.Close

Set rs = Nothing
Set cn = Nothing

End Function












 
Old August 6th, 2003, 07:41 AM
Authorized User
 
Join Date: Aug 2003
Location: , , .
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default

did u register your component properly???


Chintu




Similar Threads
Thread Thread Starter Forum Replies Last Post
Using HSQLDB database for container authentication remmons Apache Tomcat 3 September 4th, 2007 09:06 AM
login authentication with database ashkitt BOOK: ASP.NET Website Programming Problem-Design-Solution 1 August 16th, 2005 02:23 PM
form-based authentication using a database waru BOOK: Beginning ASP.NET 1.0 2 May 28th, 2004 10:37 PM
Authentication PbsiGuru General .NET 6 March 24th, 2004 02:41 PM





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