-
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 & "')"
-
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 & "')"
-
It may b ur solution
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.
-
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