Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DLL Database connection - no workie !

Status
Not open for further replies.

PeterMac

Programmer
Mar 9, 2001
51
CA
Hey :

I am trying to make a "simple" DLL that accepts userid and password in a VB DLL and using that info connecting to a database and testing for a valid login. I wrote the DLL and registered it (I think) and then wrote the ASP to use it, yet I get an object required message. here is the DLL code and following is the ASP code. Any help or pointers greatfully accepted!
=================================
DLL VB Code
=================================

Public Function login_test(user_id, password) As Boolean
Dim objConn, strConnection, objRS, strQuery, Answer

Set objConn = Server.CreateObject("ADODB.Connection")
strConnection = "DSN=secure;Database=secure;UID=secure_login;PWD=simonp;"
objConn.Open strConnection

strQuery = "SELECT * FROM login WHERE userid = '" & user_id & "';"
Set objRS = objConn.Execute(strQuery)

If objRS.EOF = True Then
Answer = False
Else
If objRS(&quot;password&quot;) <> password Then
Answer = False
Else
Answer = True
End If
End If

login_test = Answer

End Function

=================================
ASP Code
=================================
<% @LANGUAGE = VBScript %>
<% option explicit

Response.Expires = 0

Dim objConn, objRS, strQuery, loginOBJ, result
Dim strConnection, strBuild, form_psw, database_psw, form_user, database_user

If Request.ServerVariables(&quot;CONTENT_LENGTH&quot;) <> 0 Then

form_user = request.form(&quot;username&quot;)
form_psw = request.form(&quot;password&quot;)

'register the DLL object and instantiate it as loginOBJ
set loginOBJ = server.createobject(&quot;GPN.login&quot;)

result = loginOBJ.login_test(form_user, form_psw)

if result = FALSE then
Response.Cookies(&quot;UserName&quot;) = &quot;&quot;
response.redirect &quot;messages/login_failed.asp&quot;
else
Response.Cookies(&quot;UserName&quot;) = form_user
response.redirect &quot;index.asp&quot;
end if

end if

%>
 
hi,

u check whether the project name and class name (GPN.login-projectname.classname) is spelled correctly. also check whether the MS ActiveX Data Objects is checked in the References menu in VB.

if everything is ok. stop the web server and restart. i think this will help u.
 
hi,

u check whether the project name and class name (GPN.login-projectname.classname) is spelled correctly. also check whether the MS ActiveX Data Objects is checked in the References menu in VB.

if everything is ok. stop the web server and restart. i think this will help u.

by
lenin
lenin_j@rediffmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top