Hi:
I am trying to get a DLL to connect to a database and return a TRUE/FALSE based on results...
Can anyone point me to a link SPECIFICALLY on this topic. Or help me with this code... All me reading says it should work, but I think I am missing a part on how to register the DLL. I am using IIS on Win2000 Server and I am developing the DLL on the same machine... so I am told that the DLL should already be registered on my system.
I have the following code that I wrote myself, and am getting an "Object Required" error when I call the function in my ASP...
=================================
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("password" <> 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("CONTENT_LENGTH" <> 0 Then
form_user = request.form("username"
form_psw = request.form("password"
'register the DLL object and instantiate it as loginOBJ
set loginOBJ = server.createobject("GPN.login"
result = loginOBJ.login_test(form_user, form_psw)
if result = FALSE then
Response.Cookies("UserName" = ""
response.redirect "messages/login_failed.asp"
else
Response.Cookies("UserName" = form_user
response.redirect "index.asp"
end if
end if
%>
I am trying to get a DLL to connect to a database and return a TRUE/FALSE based on results...
Can anyone point me to a link SPECIFICALLY on this topic. Or help me with this code... All me reading says it should work, but I think I am missing a part on how to register the DLL. I am using IIS on Win2000 Server and I am developing the DLL on the same machine... so I am told that the DLL should already be registered on my system.
I have the following code that I wrote myself, and am getting an "Object Required" error when I call the function in my ASP...
=================================
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("password" <> 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("CONTENT_LENGTH" <> 0 Then
form_user = request.form("username"
form_psw = request.form("password"
'register the DLL object and instantiate it as loginOBJ
set loginOBJ = server.createobject("GPN.login"
result = loginOBJ.login_test(form_user, form_psw)
if result = FALSE then
Response.Cookies("UserName" = ""
response.redirect "messages/login_failed.asp"
else
Response.Cookies("UserName" = form_user
response.redirect "index.asp"
end if
end if
%>