PDA

Click to See Complete Forum and Search --> : Inserting Form Responses into Databases


yoeddy25
Aug 29th, 2000, 09:00 AM
Can anyone help? - I have my code for updating my database using insert statement - can anyone check it as its bringing up a syntax error and I can't figure it out.


data_source = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _
Server.MapPath("vacancies.mdb")
sql_insert = "INSERT INTO job (position,jobdescription,salary,startdate,contact) " & _
VALUES ('" & position & "', '" & jobdescription & "', '" & salary & "', '" & startdate & "', '" & contact & "')"

dcarlson
Aug 29th, 2000, 09:23 AM
Looks like you're missing a " in front of VALUES

sql_insert = "INSERT INTO job (position,jobdescription,salary,startdate,contact) " & _
"VALUES ('" & position & "', '" & jobdescription & "', '" & salary & "', '" & startdate & "', '" & contact & "')"

asad_s23
Aug 29th, 2000, 03:33 PM
data_source = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("vacancies.mdb")


sql_insert = "INSERT INTO job(position,jobdescription,salary,startdate,contact) " _
& "VALUES ('" & position & "', '" & jobdescription & "'," & salary & ",'" & startdate & "', '"& contact & "')"

i 've assumed that salary is the integer field.

dcarlson
Aug 29th, 2000, 03:49 PM
Even your startdate may need a # character before and after.

sql_insert = "INSERT INTO job(position,jobdescription,salary,startdate,contact) " _
& "VALUES ('" & position & "', '" & jobdescription & "'," & salary & ",#" & startdate & "#, '"& contact & "')"

I think the best way is to find out what is getting stored in sql_insert by using:

Response.Write sql_insert