Professional Web Applications Themes

SQL Update problem - ASP Database

The following SQL statement is resulting in the error after it: (pasted from IE window) UPDATE Clients SET number = 300, name = 'Ace Lock', address1 = 'add1', address2 = 'add2', city = 'city', state = 'pa', zip = '15222' WHERE id = 1; Warning: (null)(): Invoke() failed: Exception occurred. Source: Microsoft JET Database Engine Description: Syntax error in UPDATE statement. in c:\inetpub\wwwroot\kdaclients.php on line 40 When I take out the number and name fields, it works fine UPDATE Clients SET address1 = 'add1', address2 = 'add2', city = 'city', state = 'pa', zip = '15222' WHERE id = 1; ...

  1. #1

    Default SQL Update problem

    The following SQL statement is resulting in the error after it:

    (pasted from IE window)

    UPDATE Clients SET number = 300, name = 'Ace Lock', address1 = 'add1',
    address2 = 'add2', city = 'city', state = 'pa', zip = '15222' WHERE id = 1;


    Warning: (null)(): Invoke() failed: Exception occurred. Source: Microsoft
    JET Database Engine Description: Syntax error in UPDATE statement. in
    c:\inetpub\wwwroot\kdaclients.php on line 40


    When I take out the number and name fields, it works fine

    UPDATE Clients SET address1 = 'add1', address2 = 'add2', city = 'city',
    state = 'pa', zip = '15222' WHERE id = 1;

    The number field is a number, the rest are text fields. Any input
    appreciated.


    TomD Guest

  2. #2

    Default Re: SQL Update problem

    Tom,

    When you use reserved words (e.g.: "name") as table or column names, you
    need to wrap them in square brackets when using them in a Jet SQL statement.
    e.g.:

    UPDATE Clients SET [number] = 300, [name] = 'Ace Lock', address1 = ...

    This allows the Jet SQL engine to recognize the names as identifiers rather
    than mis-use of the reserved words. Of course, an even better approach is
    to not use reserved words as table/column names in the first place...

    HTH,
    Nicole

    "TomD" <dcbcadmgr.nospam.> wrote in message
    news:uwKThJj8DHA.2404TK2MSFTNGP11.phx.gbl...
    > The following SQL statement is resulting in the error after it:
    >
    > (pasted from IE window)
    >
    > UPDATE Clients SET number = 300, name = 'Ace Lock', address1 = 'add1',
    > address2 = 'add2', city = 'city', state = 'pa', zip = '15222' WHERE id =
    > 1;
    >
    >
    > Warning: (null)(): Invoke() failed: Exception occurred. Source: Microsoft
    > JET Database Engine Description: Syntax error in UPDATE statement. in
    > c:\inetpub\wwwroot\kdaclients.php on line 40
    >
    >
    > When I take out the number and name fields, it works fine
    >
    > UPDATE Clients SET address1 = 'add1', address2 = 'add2', city = 'city',
    > state = 'pa', zip = '15222' WHERE id = 1;
    >
    > The number field is a number, the rest are text fields. Any input
    > appreciated.
    >
    >

    Nicole Calinoiu Guest

  3. #3

    Default Re: SQL Update problem

    Nicole Calinoiu wrote:
    > Tom,
    >
    > When you use reserved words (e.g.: "name") as table or column names,
    Just to add:
    [url]http://www.aspfaq.com/show.asp?id=2080[/url]


    HTH,
    Bob Barrows
    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.


    Bob Barrows [MVP] Guest

Similar Threads

  1. Update problem
    By takecare webforumsuser@macromedia.com in forum Macromedia Dreamweaver
    Replies: 3
    Last Post: May 13th, 03:02 PM
  2. Update problem with V10
    By koshington@adobeforums.com in forum Adobe Illustrator Macintosh
    Replies: 0
    Last Post: March 3rd, 12:56 AM
  3. inker problem (an update to the 'general problem')
    By eRez in forum Macromedia Director 3D
    Replies: 0
    Last Post: December 29th, 12:26 PM
  4. ASP Problem - will not update
    By Oli in forum ASP Database
    Replies: 3
    Last Post: November 20th, 10:12 PM
  5. apt-get update problem
    By Hubert Mercier in forum Debian
    Replies: 1
    Last Post: July 17th, 01:20 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