Professional Web Applications Themes

Insert Into wooos - ASP Database

Here is the problem I am having. I have this script: var1 = Request.Form("date") var2 = Request.Form("course") var3 = Request.Form("addey") var4 = Request.Form("par") var5 = Request.Form("rnd1") var6 = Request.Form("rnd2") var7 = Request.Form("rnd3") var8 = Request.Form("rnd4") var9 = Request.Form("current") strSQL = "INSERT INTO test (date, course, addey, par, rnd1, rnd2, rnd3, rnd4, current) VALUES ('" & var1 & "', '" & var2 & "', '" & var3 & "', '" & var4 & "', '" & var5 & "', '" & var6 & "', '" & var7 & "', '" & var8 & "', '" & var9 & "')" Conn.Execute (strSQL) ...

  1. #1

    Default Insert Into wooos

    Here is the problem I am having.
    I have this script:

    var1 = Request.Form("date")
    var2 = Request.Form("course")
    var3 = Request.Form("addey")
    var4 = Request.Form("par")
    var5 = Request.Form("rnd1")
    var6 = Request.Form("rnd2")
    var7 = Request.Form("rnd3")
    var8 = Request.Form("rnd4")
    var9 = Request.Form("current")

    strSQL = "INSERT INTO test (date, course, addey, par, rnd1, rnd2, rnd3,
    rnd4, current) VALUES ('" & var1 & "', '" & var2 & "', '" & var3 & "', '" &
    var4 & "', '" & var5 & "', '" & var6 & "', '" & var7 & "', '" & var8 & "',
    '" & var9 & "')"

    Conn.Execute (strSQL)


    i am getting the following error:


    Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
    [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO
    statement.

    /GIG/New2/ihttestasp3.asp, line 23

    I have checked and rechecked the syntax, and I can't find anything. It looks
    correct to me.

    I did a response write.. and i got this:

    INSERT INTO test (date, course, addey, par, rnd1, rnd2, rnd3, rnd4, current)
    VALUES ('12/05/2004', 'Fake Course', 'http://', '72', 'B/B/M/M/E',
    'B/F/S/D', 'B/M/S/M', 'B/F/F/E', 'No')
    Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

    [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO
    statement.
    All the data is correct from the form page.
    Any Ideas?
    Jeff


    Bam Guest

  2. #2

    Default Re: Insert Into wooos

    (a) terrible names (e.g. date)
    (b) dates are delimited by # not ' in Access
    (c) any columns that are not strings should be non-delimited (don't surround
    integers etc. with string delimiters)

    --
    http://www.aspfaq.com/
    (Reverse address to reply.)




    "Bam" <net> wrote in message
    news:phx.gbl... 

    looks 
    current) 


    Aaron Guest

  3. #3

    Default Re: Insert Into wooos

    Perhaps the fact that you have a column named "date" is a problem. See
    here. http://www.aspfaq.com/show.asp?id=2080

    Also, please see here and compare your connection string to the recommended
    connection string on this page (in the Microsoft Access section).
    http://www.aspfaq.com/show.asp?id=2126

    Also, what happens when someone types an apostrophe? Is your code prepared
    for that? http://www.aspfaq.com/show.asp?id=2035

    Ray at work



    "Bam" <net> wrote in message
    news:phx.gbl... 
    >
    > INSERT INTO test (date, course, addey, par, rnd1, rnd2, rnd3, rnd4,
    > current)
    > VALUES ('12/05/2004', 'Fake Course', 'http://', '72', 'B/B/M/M/E',
    > 'B/F/S/D', 'B/M/S/M', 'B/F/F/E', 'No')[/ref]


    Ray Guest

  4. #4

    Default Re: Insert Into wooos

    you got it.... the field date was throwing it all off. thanks a bunch :)


    "Aaron [SQL Server MVP]" <noraa> wrote in message
    news:phx.gbl... 
    surround [/ref]
    '" [/ref]
    "', 
    > looks 
    > current) 
    >
    >[/ref]


    Bam Guest

Similar Threads

  1. Question Insert from ASP to SQL using recordset data as values in insert statement
    By JasonM in forum Microsoft SQL / MS SQL Server
    Replies: 0
    Last Post: June 13th, 05:54 PM
  2. What's faster - loop for insert or insert...select.
    By mr. modus in forum Coldfusion Database Access
    Replies: 2
    Last Post: December 10th, 01:57 AM
  3. Multiple Insert or Looping Insert
    By payado in forum Dreamweaver AppDev
    Replies: 1
    Last Post: May 25th, 09:33 PM
  4. Replies: 0
    Last Post: July 23rd, 11:30 PM
  5. Replies: 3
    Last Post: September 30th, 09:24 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139