I'm having a problem with the following code. It gives me the error,
Microsoft JET Database Engine error '80040e10'
No value given for one or more required parameters.
/_scripts/_ASP/JokeoftheDay/selectionscript.asp, line 97
I've highlighted line 97 in red i'm positive all the fields are correct for the database. I've removed everything after the insert into statement and printed all the variables they all contain a valid value.
<html>
<head>
<title>JOTD - Management System</title>
</head>
<body bgcolor="#000088" text="#FFFFFF" link="#FFFFFF" vlink="#FFFFFF" alink="#FFFFFF">
<%
'Copyright Paul Morgan: April 2003
'Accesses the two joke and comic databases, generates
'a random number to pick a record from each and copies
'the random record values into the comic/joke of the
'day database
'Start timer
Dim dblStartTime
dblStartTime = Timer()
'Set Randomizer function that returns a pesudo random
'number
Function random ()
RANDOMIZE
Dim randomnum
randomnum = (rnd(1)) * 123456
random = Round(randomnum)
end function
'Create connections to the joke of the day database
Dim JOTD
Set JOTD = Server.CreateObject("ADODB.Connection")
JOTD.Mode = adModeReadWrite
JOTD.Provider = "Microsoft.Jet.OLEDB.4.0"
JOTD.Open ("c:\mydirectory\mysubdirectory\mydatabase.mdb")
'Databases are linked so open up the two joke and comic recordsets
Set jokers = Server.CreateObject("ADODB.Recordset")
Set comicrs = Server.CreateObject("ADODB.Recordset")
JokeRS.Open "SELECT * FROM LIST", JOTD
ComicRS.Open "SELECT * FROM COMIC1", JOTD
'Create two random numbers and put them into variables
Dim rannum1
Dim rannum2
rannum1 = random () + 123
rannum2 = random () + 100
'Loop through the records in the jokes database using
'the random number
jokers.movefirst
comicrs.movefirst
While rannum1 > 0
If jokers.EOF then
jokers.movefirst
jokers.movenext
rannum1 = rannum1 - 1
else
JokeRS.movenext
rannum1 = rannum1 - 1
end if
Wend
'Do the same with the comics database
While rannum2 > 0
If comicrs.EOF then
comicrs.movefirst
comicrs.movenext
rannum2 = rannum2 - 1
else
comicRS.movenext
rannum2 = rannum2 - 1
end if
Wend
'Now that the record pointer is on a random record
'in each put the records into variables and put them into
'the joke of the day database
Dim xiD
Dim cdate
Dim cid
Dim clink
Dim jname
Dim jdate
Dim jlink
xiD = 1
cdate = comicrs.fields ("DateAdded")
cid = comicrs.fields ("cid")
clink = comicrs.fields ("comiclnk")
jname = jokers.fields ("JokeName")
jdate = jokers.fields ("AdditionDate")
jlink = jokers.fields ("id")
JOTD.Execute ("DELETE * FROM comic WHERE id = '1'")
JOTD.Execute ("DELETE * FROM joke WHERE id = '1'")
JOTD.Execute ("INSERT INTO comic (id, cid, da, link) VALUES (xid, cid, cdate, clink)")
JOTD.Execute ("INSERT INTO joke (id, jname, da, link) VALUES (xid, jname, jdate, jlink)")
Response.Write ("<font size=""6"">Management System - JOTD Selection System </font><hr>")
Response.Write ("<div align=""center"">Program designed and tested by Paul A Morgan - Written in April 2003<hr>")
Response.Write ("Comic and Joke of the day sucessfully changed.<hr></div>")
Response.Write ("The comic of the day is now...<br>")
Response.Write ("Comic ID number: " & comic.fields("cid"))
Response.Write ("<br>")
Response.Write ("Date added: " & comic.fields("da"))
Response.Write ("<br>")
Response.Write ("View link: <a href=""../../../../_stuff/_comics/_imagesrc/" & comic.fields("cid") & "Here </a>")
Response.Write ("<hr>")
Response.Write ("Joke of the day is now...<br>")
Response.Write ("Joke Name: " & joke.fields("jname") &"<br>")
Response.Write ("Date Added: " & joke.fields("da") &"<br>")
Response.Write ("View Link: <a href=""../../../../_stuff/_jokes/_jokestorage/" & joke.fields("link") & "Here </a>")
jokers.close
comicrs.close
JOTD.close
Set jokers = nothing
Set comicrs = nothing
Set jotd = nothing
Response.Write ("<br><br><font size=""2"">This page was generated in" & FormatNumber(Timer() - dblStartTime, 4) & "seconds </font>")
%>
</body>
</html>
Edited by pmormr