bgreenhouse
Technical User
Hi there
I get a problem with the script shown below, stating a data type mismatch, specifically for the "strPIN" variable. If I don't fill in the PIN field in the form that requests this script, then I don't get the data type mismatch error (I do get other errors, but more on that later...). I have tried adding strPIN = Cstr(strPIN) after the initial strPIN definition, I have tried redifining the PIN field in the database as a number rather than text, and I can't seem to get the error to stop displaying...any suggestions?
<%@ LANGUAGE="VBSCRIPT" %>
<%Option Explicit%>
<% Response.Expires =0%>
<%
Session.timeout = 15
Dim Prefix, Crdnum, strPIN, SQL, DB, RS
Prefix = "12345678901"
Crdnum = Request.form("Cardnum"
Crdnum = Prefix&Crdnum
strPIN = Request.form("PIN"
SQL = "SELECT * FROM Card"
SQL = SQL & " Where CardNumber =" & Crdnum
SQL = SQL & " AND PIN =" & strPIN
Set DB = Server.CreateObject("ADODB.Connection"
Set RS = Server.CreateObject("ADODB.Recordset"
DB.Open "Northcard"
RS.Open SQL, DB, 3, 2, 1
If RS.RecordCount = 1 then
Session("Auth" = "true"
Session("Cardnum" = RS.Fields("Cardnum"
Session("CustomerID" = RS.Fields("CustomerID"
Session("UserStartTime" = Now
Else
Session("Auth" = "false"
Session("Clnt" = ""
Session("Client" = ""
Session("UserID" = ""
Session("UserFirstName" = ""
Session("UserLastName" = ""
Session("UserStartTime" = ""
End If
RS.Close: Set RS = Nothing
DB.close: Set DB = Nothing
Response.Redirect("auth.asp"
%>
I get a problem with the script shown below, stating a data type mismatch, specifically for the "strPIN" variable. If I don't fill in the PIN field in the form that requests this script, then I don't get the data type mismatch error (I do get other errors, but more on that later...). I have tried adding strPIN = Cstr(strPIN) after the initial strPIN definition, I have tried redifining the PIN field in the database as a number rather than text, and I can't seem to get the error to stop displaying...any suggestions?
<%@ LANGUAGE="VBSCRIPT" %>
<%Option Explicit%>
<% Response.Expires =0%>
<%
Session.timeout = 15
Dim Prefix, Crdnum, strPIN, SQL, DB, RS
Prefix = "12345678901"
Crdnum = Request.form("Cardnum"
Crdnum = Prefix&Crdnum
strPIN = Request.form("PIN"
SQL = "SELECT * FROM Card"
SQL = SQL & " Where CardNumber =" & Crdnum
SQL = SQL & " AND PIN =" & strPIN
Set DB = Server.CreateObject("ADODB.Connection"
Set RS = Server.CreateObject("ADODB.Recordset"
DB.Open "Northcard"
RS.Open SQL, DB, 3, 2, 1
If RS.RecordCount = 1 then
Session("Auth" = "true"
Session("Cardnum" = RS.Fields("Cardnum"
Session("CustomerID" = RS.Fields("CustomerID"
Session("UserStartTime" = Now
Else
Session("Auth" = "false"
Session("Clnt" = ""
Session("Client" = ""
Session("UserID" = ""
Session("UserFirstName" = ""
Session("UserLastName" = ""
Session("UserStartTime" = ""
End If
RS.Close: Set RS = Nothing
DB.close: Set DB = Nothing
Response.Redirect("auth.asp"
%>