Dear programmers,
I am using persists upload component. On my page I have a form with different input text fields and 1 upload (file) field. Now the uploading goed fine, only when I want to save the upload.form fields to the database it seems they are all empty:
Microsoft JET Database Engine error '80040e21'
Field 'Bedrijven.email' cannot be a zero-length string.
/matglans/scripts/basispakketformulier.asp, line 143
Here's my code:
I am using persists upload component. On my page I have a form with different input text fields and 1 upload (file) field. Now the uploading goed fine, only when I want to save the upload.form fields to the database it seems they are all empty:
Microsoft JET Database Engine error '80040e21'
Field 'Bedrijven.email' cannot be a zero-length string.
/matglans/scripts/basispakketformulier.asp, line 143
Here's my code:
Code:
<%
IF request.querystring("actie") = "opslaanstap1" THEN
Set Upload = Server.CreateObject("Persits.Upload.1")
dim pad, opslaan, firmanaam, contactpersoon, adres, postcode, plaats, telefoon, mobiel, email, kvk, logo, informatie, website, fax, AF, tekst, foto1, foto2, foto3, longitude, latitude
pad = "/" & Upload.Form("firmanaam")
Upload.Save Server.MapPath(pad)
For Each File in Upload.Files
Response.Write File.Name & "= " & File.Path & " (" & File.Size &")<BR>"
Next
opslaan = 1
IF Upload.Form("firmanaam") = "" THEN
response.write("firmanaam is een verplicht veld")
response.end
ELSE
firmanaam = upload.form("Firmanaam")
END IF
IF upload.form("contactpersoon") = "" THEN
contactpersoon = "geen"
ELSE
contactpersoon = upload.form("contactpersoon")
END IF
IF upload.form("adres") = "" THEN
response.write("Adres is een verplicht veld")
response.end
adres = ""
ELSE
adres = upload.form("adres")
END IF
IF upload.form("postcode") = "" THEN
response.write("Postcode is een verplicht veld")
response.end
postcode = ""
ELSE
postcode = upload.form("postcode")
END IF
IF upload.form("plaats") = "" THEN
response.write("Plaats is een verplicht veld")
response.end
plaats = ""
ELSE
plaats = upload.form("plaats")
END IF
IF upload.form("telefoon") = "" THEN
response.write("Telefoon is een verplicht veld")
response.end
telefoon = ""
ELSE
telefoon = upload.form("telefoon")
END IF
IF upload.form("mobiel") = "" THEN
mobiel = "geen"
ELSE
mobiel = upload.form("mobiel")
END IF
IF upload.form("email") = "" THEN
response.write("E-mail is een verplicht veld, hier worden de offerteaanvragen naar toe gestuurd")
response.end
email = ""
ELSE
email = upload.form("email")
END IF
IF upload.form("kvk") = "" THEN
response.write("KVK is een verplicht veld")
response.end
kvk = ""
ELSE
kvk = upload.form("kvk")
END IF
IF upload.form("logo") = "" THEN
logo = "geen"
ELSE
logo = upload.form("logo")
END IF
IF upload.form("informatie") = "" THEN
informatie = ""
ELSE
informatie = upload.form("informatie")
END IF
IF upload.form("website") = "" THEN
website = "geen"
ELSE
website = upload.form("website")
END IF
IF upload.form("fax") = "" THEN
fax = "geen"
ELSE
fax = upload.form("fax")
END IF
IF upload.form("AF") = "" THEN
AF = 0
ELSE
AF = upload.form("AF")
END IF
IF upload.form("tekst") = "" THEN
tekst = "geen"
ELSE
tekst = upload.form("tekst")
END IF
IF upload.form("foto1") = "" THEN
foto1 = "geen"
ELSE
foto1 = upload.form("foto1")
END IF
IF upload.form("foto2") = "" THEN
foto2 = "geen"
ELSE
foto2 = upload.form("foto2")
END IF
IF upload.form("foto3") = "" THEN
foto3 = "geen"
ELSE
foto3 = upload.form("foto3")
END IF
IF upload.form("longitude") = "" THEN
longitude = "geen"
ELSE
longitude = upload.form("longitude")
END IF
IF upload.form("latitude") = "" THEN
latitude = "geen"
ELSE
latitude = upload.form("latitude")
END IF
set objAdd = Server.CreateObject ("ADODB.Recordset")
objAdd.CursorType = 2
objAdd.LockType = 3
objAdd.Open "Bedrijven", conn
objAdd.AddNew
objAdd.Fields("firmanaam") = firmanaam
objAdd.Fields("contactpersoon") = contactpersoon
objAdd.Fields("telefoon") = telefoon
objAdd.Fields("mobiel") = mobiel
objAdd.Fields("email") = email
objAdd.Fields("kvk") = kvk
objAdd.Fields("logo") = logo
objAdd.Update
objAdd.Close
Set objAdd = Nothing
END IF
%>
<% if opslaan = 1 THEN%>
<form action="default.asp?schilder=basis&actie=stap2" method="post" ENCTYPE="multipart/form-data">
<% ELSE %>
<form action="default.asp?schilder=basis&actie=opslaanstap1" method="post" ENCTYPE="multipart/form-data">
<% END IF%>
<form action="default.asp?schilder=basis&actie=opslaanstap1" method="post" ENCTYPE="multipart/form-data">
<TABLE cellSpacing=0 cellPadding=0 width=173 border=0>
<TR>
<TD class="tekst" width="108"><FONT face="Verdana" color="#21177b" size="1">Firmanaam:</FONT></TD>
<TD width="177"><FONT face="Verdana" color="#21177b" size="1"><INPUT
class="frmZoeken" id="firmanaam" style="width: 161; height: 18" size="24"
name="firmanaam" value="<% = firmanaam %>"> </FONT></TD></TR>
<TR>
<TD class="tekst" width="108"><FONT face="Verdana" color="#21177b"
size=1>Adres:</FONT></TD>
<TD width="177"><FONT face="Verdana" color="#21177b" size="1"><INPUT
class="frmZoeken" id="adres" style="width: 161; height: 17" size="24"
name="adres" value="<% = adres %>"> </FONT></TD></TR>
<TR>
<TD class=tekst width=108><FONT face=Verdana color=#21177b
size=1>Postcode:</FONT></TD>
<TD width=177><FONT face=Verdana color=#21177b size=1><INPUT
class=frmZoeken id=postcode style="width: 161; height: 18" size=24
name=postcode value="<% = postcode %>"> </FONT></TD></TR>
<TR>
<TD class=tekst width=108><FONT face=Verdana color=#21177b
size=1>Plaats:</FONT></TD>
<TD width=177><FONT face=Verdana color=#21177b size=1><INPUT
class=frmZoeken id=E-mail0 style="width: 161; height: 18" size=24
name=plaats value="<% = plaats %>"></FONT></TD></TR>
<TR>
<TD class=tekst width=108><FONT face=Verdana color=#21177b
size=1>Telefoon:</FONT></TD>
<TD width=177><FONT face=Verdana color=#21177b size=1><INPUT
class=frmZoeken id=telefoon style="width: 161; height: 18" size=24
name=telefoon value="<% = telefoon %>"></FONT></TD></TR>
<TR>
<TD class=tekst width=108><FONT face=Verdana color=#21177b
size=1>Mobiel:</FONT></TD>
<TD width=177><FONT face=Verdana color=#21177b size=1><INPUT
class=frmZoeken id=mobiel style="width: 161; height: 18" size=24
name=mobiel value="<% = mobiel %>"></FONT></TD></TR>
<TR>
<TD class=tekst width=108><FONT face=Verdana color=#21177b
size=1>Faxnummer:</FONT></TD>
<TD width=177><FONT face=Verdana color=#21177b size=1><INPUT
class=frmZoeken id=fax style="width: 161; height: 18" size=24
name=fax value="<% = fax %>"></FONT></TD></TR>
<tr>
<TD class=tekst width=108><FONT face=Verdana color=#21177b
size=1>KVK:</FONT></TD>
<TD width=177><FONT face=Verdana color=#21177b size=1><INPUT
class=frmZoeken id=kvk style="width: 161; height: 18" size=24
name=kvk value="<% = kvk %>"></FONT></TD>
</tr>
<TR>
<TD class=tekst width=108><FONT face=Verdana color=#21177b
size=1>website:</FONT></TD>
<TD width=177><FONT face=Verdana color=#21177b size=1><INPUT
class=frmZoeken id=website style="width: 161; height: 18" size=24
name=website value="<% = website %>"></FONT></TD></TR>
<tr>
<TD class=tekst width=108><FONT face=Verdana color=#21177b size=1>logo
toevoegen:</FONT></TD>
<TD width=177>
<% if opslaan = 1 THEN%>
<IMG SRC="<% = logo %>" alt="<% = firmanaam%>">
<% ELSE %>
<INPUT TYPE="FILE" NAME="logo" SIZE="10" value="<% = logo %>">
<% END IF%>
</TD>
</tr>
<tr>
<TD class=tekst width=108><FONT face=Verdana color=#21177b size=1>longitude:</FONT></TD>
<TD width=177><INPUT
style="font-size: 9px; width: 162; font-family: Verdana; height: 18"
type="text" name="longitude" size="24"></TD>
</tr>
<TR>
<TD class="tekst" width="108"><FONT face="Verdana" color="#21177b" size="1">latitude:</FONT></TD>
<TD width="177"><INPUT
style="font-size: 9px; width: 162; font-family: Verdana; height: 18"
type="text" name="latitude" size="24"></TD></TR>
<TR>
<TD class=tekst width=108><FONT face=Verdana size=1><INPUT class=tekst style="FONT-SIZE: 9px; WIDTH: 81px; FONT-FAMILY: Verdana; HEIGHT: 18px" type=submit value=">> stap 2" name=Submit></FONT></TD>
<TD width=177><font color="#000080" face="Verdana" size="1"><b><a href="algemenevoorwaardenvoordeelnemingbedrijven.htm"> Algemene
voorwaarden <BR>voor deelname</a></b></font></TD></TR></TABLE>
</form>