Results 1 to 4 of 4

Thread: Inserting Form Responses into Databases

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Posts
    5

    Question

    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 & "')"

  2. #2
    Hyperactive Member
    Join Date
    Apr 2000
    Location
    Sudbury, Ontario, Canada
    Posts
    274
    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 & "')"

  3. #3
    Junior Member
    Join Date
    May 2000
    Location
    Karachi,Pakistan
    Posts
    16

    Unhappy 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.

  4. #4
    Hyperactive Member
    Join Date
    Apr 2000
    Location
    Sudbury, Ontario, Canada
    Posts
    274
    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



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width