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