Home > ASP Development > Syntax error Insert into

Syntax error Insert into



Dear Experts,



I keep getting the following error message:



Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)

[Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.

/ORG/HRM/medewerkertoevoeg.asp, line 50



I treid different solutions but here is the code:




Code:



StrSQL = "Insert Into Medewerker(Med_nr,afd_id,Med_naam,Med_voor,Med_tus 1,Med_tus2,Med_roep,Med_ini,Med_tel,Med_email,Med_ mutdat,Med_gebdatum,Med_indienst,Afwezig op,Med_mobiel,Funktie_id,werkstatus)"& _
"VALUES ('"& Request.Form("med_nr") &"'," & Request.Form("mainselect")& ","& _
"'"& Request.Form("med_naam") &"','"& Request.Form("med_voor") &"','"& hulptus1 &"','"& hulptus2 &"',"& _
"'"& Request.Form("med_roep") &"','"& Request.Form("med_ini") &"','"& Request.Form("med_tel") &"','"& Request.Form("med_email") &"','"& datumnu &"',"& _
"'"& geboortesamenvoeging &"','"& indienstsamenvoeging &"','"& Request.Form("Med_afwezigop") &"','"& Request.Form("Med_mobiel") &"'," & Request.Form("mainselect2")& ",'"& Request.Form("Werkstatus") &"');"






It is fine i think , i treid to free the integer value from the string but the result is the same. The code above is with freeing of integers and the code below without:




Code:



StrSQL = "Insert Into Medewerker(Med_nr,afd_id,Med_naam,Med_voor,Med_tus 1,Med_tus2,Med_roep,Med_ini,Med_tel,Med_email,Med_ mutdat,Med_gebdatum,Med_indienst,Afwezig op,Med_mobiel,Funktie_id,werkstatus)"& _
"VALUES ('"& Request.Form("med_nr") &"','" & Request.Form("mainselect")& "',"& _
"'"& Request.Form("med_naam") &"','"& Request.Form("med_voor") &"','"& hulptus1 &"','"& hulptus2 &"',"& _
"'"& Request.Form("med_roep") &"','"& Request.Form("med_ini") &"','"& Request.Form("med_tel") &"','"& Request.Form("med_email") &"','"& datumnu &"',"& _
"'"& geboortesamenvoeging &"','"& indienstsamenvoeging &"','"& Request.Form("Med_afwezigop") &"','"& Request.Form("Med_mobiel") &"','" & Request.Form("mainselect2")& "','"& Request.Form("Werkstatus") &"');"










the result (response.write strsql):

Insert Into Medewerker(Med_nr,afd_id,Med_naam,Med_voor,Med_tus 1,Med_tus2,Med_roep,Med_ini,Med_tel,Med_email,Med_ mutdat,Med_gebdatum,Med_indienst,Afwezig op,Med_mobiel,Funktie_id,werkstatus)VALUES ('10000','28','Meussen','F','der','der','Koen','FM ','6578','f.meussen@planet.nl','4/3/2006 12:56:37 PM','02/03/1982','04/08/2000','Woensdag,Dinsdag','06-42726465','27','Stagiair'); Uw gegevens voor het smoelenboek zijn verwerkt bedankt.



what am i doing wrong here?

    
Guest


try this


Code:



StrSQL = "Insert Into Medewerker(Med_nr,afd_id,Med_naam,Med_voor,Med_tus 1,Med_tus2,Med_roep,Med_ini,Med_tel,Med_email,Med_ mutdat,Med_gebdatum,Med_indienst,Afwezig op,Med_mobiel,Funktie_id,werkstatus)"& _
"VALUES ('"& Request.Form("med_nr") &"','" & Request.Form("mainselect")& "',"& _
"'"& Request.Form("med_naam") &"','"& Request.Form("med_voor") &"','"& hulptus1 &"','"& hulptus2 &"',"& _
"'"& Request.Form("med_roep") &"','"& Request.Form("med_ini") &"','"& Request.Form("med_tel") &"','"& Request.Form("med_email") &"','"& datumnu &"',"& _
"'"& geboortesamenvoeging &"','"& indienstsamenvoeging &"','"& Request.Form("Med_afwezigop") &"','"& Request.Form("Med_mobiel") &"','" & Request.Form("mainselect2")& "','"& Request.Form("Werkstatus") &"');"



Was this answer helpful ? Yes No   
Guest


Nope, this just give the same error message.



What is wrong ???

Was this answer helpful ? Yes No   
Guest


i found it myself:



the error was triggered bij the field: Afwezig op

this must be: [Afwezig op]

Was this answer helpful ? Yes No   
Guest


Afwezig op

i thinl this is reserved words ..can u translate it into english

Was this answer helpful ? Yes No   
Guest


Quote:
Originally Posted by Guddu
Afwezig op

i thinl this is reserved words ..can u translate it into english




absence on

Was this answer helpful ? Yes No   
Guest


Quote:
Originally Posted by Guddu
Afwezig op

i thinl this is reserved words ..can u translate it into english




It has a space - hence the need for []



It is very bad practice to put spaces in table/field names. Where

possible avoid it. Use _ instead of space.



[a bad example] becomes [a_bad_example]

Was this answer helpful ? Yes No   
Guest
 
 
Home - About Infoqu - Contact - Privacy Statement - Link to Infoqu - Bookmark Infoqu

Copyright 2007-2008 by Infoqu. All rights reserved