Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2004
    Location
    Phnom Penh
    Posts
    9

    Unanswered: Problem with inserting record into access table

    Dear All,

    Your help would be much appriciated as i could not find the mistake.

    I am trying to insert a record into a table in ms access database, but got the syntax error, insert into...

    thanks
    Attached Files Attached Files

  2. #2
    Join Date
    Nov 2003
    Posts
    76
    try to change your sql to this. HTH

    sql = "Insert into tb_user(Username,Password) values(" & "'" & Username & "'" & "," & "'" & password & "'" & ")"

  3. #3
    Join Date
    Jan 2004
    Posts
    2
    Try this. This should work it is the field name some times it could be a key word. It is always good practice in the database to cover field name in "[]" .


    dim sql
    sql = "Insert into tb_user([Username],[Password]) values('"
    sql = sql & Username & "','"
    sql = sql & Password &"')"

  4. #4
    Join Date
    Jan 2004
    Posts
    2
    If you do not want to use variables. Then you can use something like this.



    dim sql
    sql = "Insert into tb_user([Username],[Password]) values('"
    sql = sql & request.form("username") & "','"
    sql = sql & request.form("password") &"')"


    Veryfy the sql code using this
    response.write sql

  5. #5
    Join Date
    Jan 2004
    Posts
    10

    Cool Insert Record Fixed

    Hi,
    I just checked your problem and fix it. I include a readme file indicaing some details for next time this happen and the changes I made.
    Attached Files Attached Files

  6. #6
    Join Date
    Jan 2004
    Location
    Phnom Penh
    Posts
    9
    Thanks to everyone for your help.

    The problem has been fixed now, and it is because of i used the restriced keyword in the field name. Anyway, how do i know which is the restricted keyword?

    Cheers!!

Posting Permissions

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