Jeg forsøger at få billeder ind i nyhedssystem, men får denne
fejl:
Microsoft OLE DB Provider for ODBC Drivers error '80040e10'
[Microsoft][ODBC Microsoft Access Driver] Too few parameters.
Expected 3.
/asp/opret.asp, line 123
<!-- ---------------------- på linie 123 står der:
Conn.Execute(strSQL) -->
---------------------------------
Koden fra linie 47 til 143 er:
---------------------------------
<form method="POST" action="opret.asp?mode=oprettet">
<div align="center">
<center>
<table border="0" width="500" cellspacing="0" cellpadding="2">
<tr>
<td width="100%" style="border: 1 solid #000000"
bgcolor="#BECACD"><b>Opret nyhed</b></td>
</tr>
<tr>
<td width="100%" style="border-left: 1 solid #000000;
border-right: 1 solid #000000; border-bottom: 1 solid #000000">
<table border="0" width="100%" cellspacing="0"
cellpadding="3">
<tr>
<td width="16%"><b>Overskrift</b></td>
<td width="50%"><font face="verdana" size="1">
<input type="text" name="overskrift" size="62"
style="font-size: 8pt; font-family: Verdana; border: 1 solid
#000000">
</font>
</td>
</tr>
<tr>
<td width="16%"><font face="verdana"
size="1"><b>Billede</b></font></td>
<td width="50%"><font face="verdana" size="1">
<%
mvirtual = "/asp/myndir/" 'her billeder
set fso = Server.CreateObject("Scripting.FileSystemObject")
set mappa = fso.GetFolder(Server.MapPath(mvirtual))
set filur = mappa.files
tmp = "<SELECT SIZE=4 NAME=""mynd" CLASS=""field"">" & VbCrLf
tmp = tmp & "<OPTION SELECTED VALUE=""" & "Eingin mynd" & """"
tmp = tmp & ">-- Eingin mynd --</OPTION>" & VbCrLf
for each file in filur
tmp = tmp & "<OPTION VALUE=""" & file.name & """"
tmp = tmp & ">" & file.name & "</OPTION>" & VbCrLf
Next
tmp = tmp & "</SELECT>"
set filur = nothing
set mappa = nothing
set fso = nothing
Response.Write(tmp)
%>
</td>
</tr>
<tr>
<td width="16%"><b>Tekst</b></td>
<td width="50%"><textarea rows="16" name="tekst"
cols="61"></textarea></td>
</tr>
<tr>
<td width="16%"></td>
<td width="50%"><font face="verdana" size="1">
<input type="submit" value="Opret nyhed" name="B1"
style="background-color: #DCE2E4">
</font>
</td>
</tr>
</table>
</td>
</tr>
</table>
</center>
</div>
</form>
<br>
<%
end if
elseif strMode = "oprettet" then
if Session("Brugeradgang") = True then
Set Conn = Server.CreateObject("ADODB.Connection")
DSN = "DRIVER={Microsoft Access Driver (*.mdb)}; "
DSN = DSN & "DBQ=" & Server.MapPath("database.mdb")
Conn.Open DSN
strSQL = "Insert into news (dato, overskrift, tekst, mynd) values
(" & DatePart("D",Now()) & "-" & DatePart("M",Now()) & "-" &
DatePart("YYYY",Now()) & "," & Request.Form("overskrift") & "," &
Request.Form("tekst") & ", " & Request.Form("mynd") & ")"
Conn.Execute(strSQL) <!-- linie 128 er her -->
Conn.Close
Set Conn = Nothing
Response.Redirect "opret.asp"
end if
elseif strMode = "ret" then
if Session("Brugeradgang") = True then
Set Conn = Server.CreateObject("ADODB.Connection")
DSN = "DRIVER={Microsoft Access Driver (*.mdb)}; "
DSN = DSN & "DBQ=" & Server.MapPath("database.mdb")
Conn.Open DSN
strQuery = "SELECT * FROM news WHERE id = " &
Request.Querystring("news_id") & ""
Set rs = Conn.Execute(strQuery)
%>
--
Vil du lære at kode HTML, XHTML, CSS, SSI eller ASP?
- Pædagogiske tutorials på dansk
- Kom godt i gang med koderne
KLIK HER! =>
http://www.html.dk/tutorials