I don't know what is wrong with this?

  • 16 years ago

    I have made a Response.Write of the SQL statement


    Quote:
    INSERT INTO movies_movies (title,author,date,comments,width,height) VALUES ('My Cool Movie','2','5/02/2003','My Cool Movie rocks It is cool','550','400')


    I don't know what is wrong with with this simple sql statement.


    Thanks for all your help

  • 16 years ago

    this is the error that iis displays


    Quote:
    Error Type:
    Microsoft JET Database Engine (0x80040E14)
    Syntax error in INSERT INTO statement.
    /stickkiller/movieupload.asp, line 15


    Thanks

  • 16 years ago

    Are the width and height fields defined in the db as integer values, just your sql statement has placed them in quote marks, implying you are trying to insert a string into these fields?


    See if that helps


    zing

  • 16 years ago

    Yes height and width are integers and also author
    I have changed all 3 and i still get the same error


    is there something with the date field i should know?


    thanks for your time

  • 16 years ago

    here are the fields


    id    AutoNumber
    title    Text
    author    Number
    date    Date/Time
    comments    Memo
    width    Number
    height    Number
    views    Number

  • 16 years ago

    I'm bit unsure about this but with dates I think you can enter them as

    5/02/2003# rather than quote marks. Having said that, I've used quote marks to enter dates to a date field in a VB application with no problems.



    Mmmm. Have you tried copying and pasting the sql statement directly into the SQL console of Access (I assume that's what you're using). Sometimes I do this as it gives more meanful syntax error reports.




  • 16 years ago

    could u tell me where the sql console is so i can put it in there


    thanks

  • 16 years ago

    maybe it doesn't like the field named "date", as its a reserved keyword?

  • 16 years ago

    no it doesn't matter because i have 'date' in a table in another access db


    thanks

  • 16 years ago

    Access SQl console


    Open Access db, select Queries, then double click create query in design view.
    A window will appear labelled Show Table. Close this...Select View|SQL view and a window will appear where you can paste in your SQL statement



  • 16 years ago

    I think you must enclose the word Date in braces:

    Quote:
    INSERT INTO movies_movies (title,author,[date],comments,width,height) VALUES ('My Cool Movie',2,#5/02/2003#,'My Cool Movie rocks It is cool',550,400)

  • 16 years ago

    thanks webjose that was the reason, if i changed the 'date' field to something like 'inserteddate' then would i need the square brackets/braces?


    Thanks to everyone who has helped in this topic all you work/help has been greatly appricated


    Thanks to zingmatter, James Crowley and webjose.

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“It works on my machine.” - Anonymous