Spot en "Fejl"

Tags:    asp

<%
session.lcid = 1030

Function DBDate(fDate)
dim fDay, fMon, fYear
fYear= Year(fDate)
fMon= Month(fDate)
fDay= Day(fDate)
fDay= right("0"&fDay, 2)
fMon= right("0"&fMon, 2)
DBDate = "#"& fMon &"-"& fDay &"-"& fYear &"#"
end function

Set conn = Server.CreateObject("ADODB.Connection")
Conn.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ="&Server.MapPath("db.mdb")

sql = "Insert into kunder (navn, adresse, tlf, mail, ip) values ('" & replace(Request.Form("navn"),"'","''") & "', '" & replace(Request.Form("adresse"),"'","''") & "', " & replace(Request.Form("tlf"),"'","''") & ", '" & replace(Request.Form("mail"),"'","''") & "', '" & Request.ServerVariables("REMOTE_ADDR") & "')"
Conn.Execute(sql)
sql2 = "select top 1 * from kunder where ip = '" & Request.ServerVariables("REMOTE_ADDR") & "' order by id desc"
set rs2 = Conn.Execute(sql2)

For Each bla in Request.Form
If Request.Form(bla) = "ON" Then
del = Split(bla,"_")
Typeen = del(0)
VaerelsesNummer = del(1)
Datoen = del(2)

sql3 = "select * from booking where dato = "&DBDate(Datoen)&""
set rs3 = Conn.Execute(sql3)
if rs3.eof then

sql4 = "Insert into booking (dato, "& Typeen & VaerelsesNummer &") values ("&DBDate(Datoen)&", '"& rs2("navn") & "_" & rs2("id") &"')"
Conn.Execute(sql4)

else
sql5 = "UPDATE booking SET "& Typeen & VaerelsesNummer &" = '"& rs2("navn") & "_" & rs2("id") &"' where dato = "&DBDate(Datoen)&""
Conn.Execute(sql5)
end if

End If
Next
response.redirect "default.asp?dato="&request.form("gemdato")&""
%>



t