With the code from below I keep getting the following error and I'm at a lose since it appears my parameters are being passed. What I currently have is a login screen where a person logs in and hits submit - then they
go to submitlogin.asp (see full code below) which checks them. Then provided everything is A-OK then move on to nextpage.asp - A database.asp page (see full code below)is used to connect to my SQL 2000 Server - I'm running Windows 2000 Server and as you can see using classic ASP:
Type mismatch: '[string: "SELECT user, pw"]'
/TestWeb/submitlogin.asp, line 18
Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
Page:
POST 31 bytes to /TestWeb/submitlogin.asp
POST Data:
user=TESTUSER&pw=testpw
<% @LANGUAGE = VBScript %>
<% ' submitlogin.asp
' test if a bill_code and eventually a password were
' entered. If not, transfer back to the login page.
If Request.form( "pw" ) = "" Or _
Request.form( "user" ) = "" Then
Session( "loginFailure" ) = True
Call Server.Transfer( "login.asp" )
End If
Dim connection, loginData
' create the SQL query
Session( "query" ) = _
"SELECT user, pw FROM mydb.dbo.users where user = UPPER'" & _
Request.form("user") & "'" and pw = UPPER'" & _
Request.form("pw") & "'"
Call Server.Execute( "database.asp" )
SetloginData = Session( "loginData" )
If Request( "user" ) = loginData( "user" ) Then
' user is OK, adjust loginFailure
Session( "loginFailure" ) = False
' write a cookie to recognize them the next time they
' go to login.asp
Response.Cookies( "user" ) = Request( "user" )
' give it three days to expire
Response.Cookies( "user" ).Expires = Date() + 3
' send them to nextpage.asp
Call Server.Transfer( "nextpage.asp" )
Else
Session( "loginFailure" ) = True
Call Server.Transfer( "login.asp" )
End If
%>
<% @LANGUAGE = VBScript %>
<%
' database.asp
' ASP document for interacting with the database
Option Explicit
Dim connection, loginData
' provide error handling code
On Error Resume Next
Session( "errorString" ) = ""
Set connection = Server.CreateObject( "ADODB.Connection" )
connection.Mode = 3
Call connection.Open( "TestWeb" )
Call errorHandlerLog()
' create the record set
Set loginData = Server.CreateObject( "ADODB.Recordset" )
Call loginData.Open( Session( "query" ), connection )
Set Session( "loginData" ) = loginData
Call errorHandlerLog()
Sub errorHandlerLog()
If Err.Number <> 0 Then
Dim errorString
errorString = Session( "errorString" )
errorString = errorString & "<p class = " & _
Chr( 34 ) & "error" & Chr ( 34 ) & ">Error (" _
& Err.Number & ") in " & Err.Source & "<br />" & _
Err.Description & "</p><br />"
Session( "errorString" ) = errorString
End If
End Sub
%>