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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data Conversion

Status
Not open for further replies.

bgreenhouse

Technical User
Feb 20, 2000
231
CA
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=&quot;VBSCRIPT&quot; %>
<%Option Explicit%>
<% Response.Expires =0%>
<%
Session.timeout = 15


Dim Prefix, Crdnum, strPIN, SQL, DB, RS

Prefix = &quot;12345678901&quot;

Crdnum = Request.form(&quot;Cardnum&quot;)
Crdnum = Prefix&Crdnum


strPIN = Request.form(&quot;PIN&quot;)


SQL = &quot;SELECT * FROM Card&quot;
SQL = SQL & &quot; Where CardNumber =&quot; & Crdnum
SQL = SQL & &quot; AND PIN =&quot; & strPIN

Set DB = Server.CreateObject(&quot;ADODB.Connection&quot;)
Set RS = Server.CreateObject(&quot;ADODB.Recordset&quot;)
DB.Open &quot;Northcard&quot;
RS.Open SQL, DB, 3, 2, 1

If RS.RecordCount = 1 then
Session(&quot;Auth&quot;) = &quot;true&quot;
Session(&quot;Cardnum&quot;) = RS.Fields(&quot;Cardnum&quot;)
Session(&quot;CustomerID&quot;) = RS.Fields(&quot;CustomerID&quot;)
Session(&quot;UserStartTime&quot;) = Now

Else
Session(&quot;Auth&quot;) = &quot;false&quot;
Session(&quot;Clnt&quot;) = &quot;&quot;
Session(&quot;Client&quot;) = &quot;&quot;
Session(&quot;UserID&quot;) = &quot;&quot;
Session(&quot;UserFirstName&quot;) = &quot;&quot;
Session(&quot;UserLastName&quot;) = &quot;&quot;
Session(&quot;UserStartTime&quot;) = &quot;&quot;
End If

RS.Close: Set RS = Nothing
DB.close: Set DB = Nothing

Response.Redirect(&quot;auth.asp&quot;)
%>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top