<%
Dim DSNName
Dim DBUserName
Dim DBPassword
Dim dbConn
Dim results
Dim SQLStatement
' Database connection sub
sub db_connect
' Create a connection object
set dbConn = server.createobject("ADODB.connection")
' Open a connection using the following criteria - DSN Name, UserName, Password
dbConn.open DSNName, DBUserName, DBPassword
end sub
' Database disconnect sub
sub db_disconnect
dbConn.close
end sub
' DSN Connection info
DSNName="LN" ' DSN Name
DBUserName="Greg Griffiths" ' Notes User Name
DBPassword="password" ' Notes Password
' Create the SQL to return any matches if the uppercased version of the username
' and the actual password are found in the View called myNewView
SQLStatement="SELECT * FROM myNewView WHERE ucuserid='" & UCase(Request.Form("userid")) & "
SQLStatement=SQLStatement & "' AND password='" & Request.Form("password") & "'"
' connect to the DB
db_connect
' run the Query
set results=dbConn.execute(SQLStatement)
' If the results set is empty
if (results.EOF) then
response.write("No Match")
else
response.write("Match")
end if
' Close the results set
results.close
' Disconnect from the Datasource
db_disconnect
%>
In the final section of this article we review what we have achieved and provide links and books for futher study.