error '800a000d' Type mismatch: 'CInt' ??????
Har et webcard-script, og får denne error-koden når man skal se det sendte kortet:Microsoft VBScript runtime error '800a000d'
Type mismatch: 'CInt'
/web/interact/webcard/view.asp, line 73
Er ingen racer i asp selv (grunnkoden er nedlastet fra hotscript.com, eller noe slikt), og jeg lurer på hva som er feil i koden min. Her er HELE koden i view.asp.
Linje 73 er
SQLStmt = "SELECT * FROM postal WHERE ID_POSTAL = " & _
___________________KODE HER_______________________
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<%
Dim fromn
Dim ident
Dim psw
' erring tells us if the card already
' exists. By default, we assum it does.
Dim erring
' I normaly use 0 and 1 for boolean,
' cause it is quicker
erring = 0
' Receiving the information
' from the link that led to this file;
' this one tell us
' what kind of access we're doing
fromn = Request.QueryString("fromn")
' here we take the ID from the post card,
' for us to know wich card we want to see.
' All this information will be compared with
' the one in the database.
ident = Request.QueryString("ident")
' This is the password
' We do not want a person that knows there exists a
' postcard with ID 13 tries to see one with ID 12.
' We will generate a random number for the password
psw = Request.QueryString("psw")
if fromn = "seeit" then
' If we just want to see the preview
' I have created sessions to keep the information,
' so that I can view the data at any step
session("postal") = Request.form("R1")
session("namefrom") = Request.form("namefrom")
session("emailfrom") = Request.form("emailfrom")
session("nameto") = Request.form("nameto")
session("emailto") = Request.form("emailto")
session("message") = Request.form("message")
else
'Someone is wanting to see an already sent card
'Open the DB connection
Set Conn = Server.CreateObject("ADODB.Connection")
' DSNless connection to Access Database
DSNtemp="DRIVER={Microsoft Access Driver (*.mdb)}; "
DSNtemp=dsntemp & "DBQ=" & server.mappath("postal.mdb")
conn.Open DSNtemp
' DSNless connection to Access Database
'Create a recordset
Set rs = Server.CreateObject("ADODB.Recordset")
' This is asimple SQL statement that see if the ID and
' password are connected in the DB
SQLStmt = "SELECT * FROM postal WHERE ID_POSTAL = " & _
CInt(ident) & " AND passw = " & CInt(psw)
' Execute the SQL statementz
rs.Open SQLstmt, Conn, 1, 2
if rs.EOF then
'Post card doesn't exist or invalid password!
erring = 1
else
'Postcard does exist. Populate the session
'variables with the database info.
session("postal") = rs("postal")
session("namefrom") = rs("namefrom")
session("emailfrom") = rs("emailfrom")
session("nameto") = rs("nameto")
session("emailto") = rs("emailto")
session("message") = rs("message")
'if fromn have "seeit we will show =
end if
end if
%>
<html>
<body
marginheight="0"
marginwidth="0"
topmargin="0"
leftmargin="0"
background="images/something.gif"
bgcolor="#002400"
text="#FCC403"
>
<%
' At this time we will see if there has been an error
' We also want to make sure the form data is valid.
if erring <> 1 and (fromn="seeit" or fromn="out") and session("postal") <> "" then
' if everything is correct we show the information
%>
<div align="left">
<table border="0" width="580" cellspacing="0" cellpadding="0">
<tr>
<td width="50%" valign="top" align="left"><br>
<br>
<img src="images/<%=session("postal")%>.jpg" hspace="5"
border="2" WIDTH="354" HEIGHT="231">
</td>
<td width="50%">
<table border="0" cellspacing="3" width="100%" cellpadding="3"
bordercolor="#000000" height="202">
<tr>
<td width="100%" height="109">
<p align="left">
<font face="Arial"><br>
<small>From:</small>
<strong><%=session("namefrom")%></strong>
<br>
<small>Email:</small><small><strong>
<%=session("emailfrom")%></strong></small>
<br>
<small>To:</small><strong><small>
<%=session("nameto")%></small></strong>
<br>
<small>Email:</small><small><strong>
<%=session("emailto")%></strong></small>
</font>
</td>
</tr>
<tr>
<td width="100%">
<font face="Arial">
<small>Message:</small><br>
<font size="2"><strong>
<%=session("message")%></strong>
</font>
</font>
</td>
</tr>
<tr>
<td width="100%" align="center" valign="middle" height="29">
<%
'if fromn == "seeit" we will show the
'buttons "to send" and "to retry"
if fromn="seeit" then
%>
<p align="left"><br>
<a href="java script:history.back()"> <img src="images/rebuildbotton.gif" width="60"
height="53" border="0"> </a>
<a href="enviado.asp"> <img src="images/sendbotton.gif" width="41"
height="53" border="0"></a> </td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<%
' Someone is viewing a card already made
' Show the reply button
else
%>
<br><br><br>
<a href="makin.htm" target="_self" > <img border="0" height="72" src="images/replybotton.gif"
width="176"></a>
<%
end if
' This else will only be reached if there is no card
' (i.e. the password was incorrect) We need to show
' an error message.
else
%>
<br><br>
<center>
<img src="images/error.gif" width="322" height="53"
border="0">
</center>
<br>
<%
end if
' This is where i remove all the postcards
' in the DB with more than 30 days old.
' I do not want to make a huge DB, so I clean
' it just to have the messages of the last 30 days.
' You can now ask.. "-So, why did you put this code here?"
' My response is:
' "- Because this is the place where you fill the DB,
' so if you are going to put another record
' at the DB, lets clean some old stuff."
' That being said, let's clean the db! :)
' Here we will get the system date (yes, the server date)
d = now()
' We will decrease 30 days at the date we have
d = DateAdd("d",-30,d)
Set Conn = Server.CreateObject("ADODB.Connection")
' DSNless connection to Access Database
DSNtemp="DRIVER={Microsoft Access Driver (*.mdb)}; "
DSNtemp=dsntemp & "DBQ=" & server.mappath("postal.mdb")
conn.Open DSNtemp
' DSNless connection to Access Database
Set rs = Server.CreateObject("ADODB.Recordset")
' Run a SQL query that will remove all out of date records
SQLStmt = "DELETE FROM postal WHERE data < #" & d & "#" '
'Run the query
rs.Open SQLstmt,Conn,1,2
%>
</body>
</html>
