Fejl ved opdatering af database
Jeg får denne fejl når jeg submitter fra min anden side til den side der skal poste data i min access db.Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E10)
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 2.
/test/krc/tipsbasen/add_tips.asp, line 34
Her er siden der fejler :
<%
'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim rsAddComments 'Holds the recordset for the new record to be added
Dim strSQL 'Holds the SQL query to query the database
StrHjemmeside = Trim(Replace(replace(Request.Form("Hjemmeside"),"'",""),"<","<"))
if strHjemmeside <> "" then
if LCase(left(strhjemmeside,7)) <> "http://" then
strHjemmeside = "http://" & strHjemmeside
end if
end if
'Create an ADO connection object
Set adoCon = Server.CreateObject("ADODB.Connection")
'Set an active connection to the Connection object using a DSN-less connection
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("tips.mdb")
'Create an ADO recordset object
Set rsAddComments = Server.CreateObject("ADODB.Recordset")
'Initialise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT tipstabel.forfatter, tipstabel.overskrift, tipstabel.kategori, tipstabel.hyper, tipstabel.tip, tipstabel.ip FROM tipstabel;"
'Set the cursor type we are using so we can navigate through the recordset
rsAddComments.CursorType = 2
'Set the lock type so that the record is locked by ADO when it is updated
rsAddComments.LockType = 3
'Open the recordset with the SQL query
rsAddComments.Open strSQL, adoCon
'Tell the recordset we are adding a new record to it
rsAddComments.AddNew
'Add a new record to the recordset
rsAddComments.Fields("forfatter") = Request.Form("forfatter")
rsAddComments.Fields("overskrift") = Request.Form("overskrift")
rsAddComments.Fields("kategori") = Request.Form("kategori")
rsAddComments.Fields("hyper") = Request.Form("hyper")
rsAddComments.Fields("tip") = Request.Form("tip")
rsAddComments.Fields("ip") = Request.ServerVariables("REMOTE_ADDR")
'Write the updated recordset to the database
rsAddComments.Update
'Reset server objects
rsAddComments.Close
Set rsAddComments = Nothing
Set adoCon = Nothing
'find id som vi lige har sat ind.
sqlo = "SELECT max(ID_no) FROM tipstabel"
Set rso = dbc.Execute(sqlo)
oid = Cint(rso(0))
if Request.Form("billede") = "on" then
Response.Redirect "indlaes_fil.asp?id=" & Server.URLEncode(oid)
else
Response.Redirect "view_search_selected.asp?id=" & Server.URLEncode(oid)
end if
%>
Kan nogen se hvad der er galt ?
