Having Problems With SQL Statement[ACCESS DB]

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default Having Problems With SQL Statement[ACCESS DB]

    Hi,
    This is my SQL Procedure :

    IFF(21 in(SELECT PageID FROM TBL_Trafic WHERE PageID=21), (UPDATE TBL_Trafic
    SET Hits=Hits+1, BytesUsed=BytesUsed+1713, LastEntered=now() WHERE
    PageID=21), INSERT INTO TBL_Trafic
    (WebsiteID,PageID,Hits,BytesUsed,LastEntered) VALUES (1,21,1,1713,now()))


    For some reason, I get the following error :

    Microsoft JET Database Engine (0x80040E14)
    Invalid SQL statement; expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT',
    or 'UPDATE'.
    /Config.asp, line 151

    What's the problem here?


    Roy.


    Roy Danon Guest

  2. Similar Questions and Discussions

    1. IF Statement Problems
      Hi, I'm trying to set a variable depending on the value of my user variable, but every single time it defaults to the first one. My script is...
    2. Show Access DB-content with i.e. WHEN-statement??
      I have a database with an autoincrement ID-column and a ParentID-column. Its used in a sort of "thread-environment" When a new thread is...
    3. Access 2k SQL Statement
      I am trying to get the SQL statement right for querying an Access 2k database I would like to obtain the first record of Event A and the last...
    4. Problems with SQL Statement.
      Hi. I'm trying to enter information from a HTM form and send it to an ASP page. Here's the code that I'm using as a reference. <---begin...
    5. access insert statement
      have you tried? was there an error? I'm not sure that Access has the "@@identity".... I'd suggest trying and posting the specific errors. --...
  3. #2

    Default Re: Having Problems With SQL Statement[ACCESS DB]

    Roy Danon wrote:
    > Hi,
    > This is my SQL Procedure :
    >
    > IFF(21 in(SELECT PageID FROM TBL_Trafic WHERE PageID=21), (UPDATE
    > TBL_Trafic SET Hits=Hits+1, BytesUsed=BytesUsed+1713,
    > LastEntered=now() WHERE PageID=21), INSERT INTO TBL_Trafic
    > (WebsiteID,PageID,Hits,BytesUsed,LastEntered) VALUES
    > (1,21,1,1713,now()))
    >
    >
    > For some reason, I get the following error :
    >
    > Microsoft JET Database Engine (0x80040E14)
    > Invalid SQL statement; expected 'DELETE', 'INSERT', 'PROCEDURE',
    > 'SELECT', or 'UPDATE'.
    > /Config.asp, line 151
    >
    > What's the problem here?
    >
    >
    Several problems here. Have you tested this query in Access? For one thing:
    there is no such function as IFF.

    When you test it in Access, you will see several other problems. Some of the
    standouts:
    1. you cannot use control-of-flow language in a Jet query.
    2. you cannot batch sql statements in a single query

    You have to do the control-of-flow stuff in the code that is calling the
    queries.

    Bob Barrows
    Bob Barrows
    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"


    Bob Barrows Guest

  4. #3

    Default Re: Having Problems With SQL Statement[ACCESS DB]

    Thank You,

    I think I will use a recordset to check number of records.



    Happy Hanucah,
    Roy.

    "Bob Barrows" <reb01501@NOyahoo.SPAMcom> wrote in message
    news:O8vigZXAEHA.2480@TK2MSFTNGP12.phx.gbl...
    > Roy Danon wrote:
    > > Hi,
    > > This is my SQL Procedure :
    > >
    > > IFF(21 in(SELECT PageID FROM TBL_Trafic WHERE PageID=21), (UPDATE
    > > TBL_Trafic SET Hits=Hits+1, BytesUsed=BytesUsed+1713,
    > > LastEntered=now() WHERE PageID=21), INSERT INTO TBL_Trafic
    > > (WebsiteID,PageID,Hits,BytesUsed,LastEntered) VALUES
    > > (1,21,1,1713,now()))
    > >
    > >
    > > For some reason, I get the following error :
    > >
    > > Microsoft JET Database Engine (0x80040E14)
    > > Invalid SQL statement; expected 'DELETE', 'INSERT', 'PROCEDURE',
    > > 'SELECT', or 'UPDATE'.
    > > /Config.asp, line 151
    > >
    > > What's the problem here?
    > >
    > >
    > Several problems here. Have you tested this query in Access? For one
    thing:
    > there is no such function as IFF.
    >
    > When you test it in Access, you will see several other problems. Some of
    the
    > standouts:
    > 1. you cannot use control-of-flow language in a Jet query.
    > 2. you cannot batch sql statements in a single query
    >
    > You have to do the control-of-flow stuff in the code that is calling the
    > queries.
    >
    > Bob Barrows
    > Bob Barrows
    > --
    > Microsoft MVP - ASP/ASP.NET
    > Please reply to the newsgroup. This email account is my spam trap so I
    > don't check it very often. If you must reply off-line, then remove the
    > "NO SPAM"
    >
    >

    Roy Danon Guest

  5. #4

    Default Having Problems With SQL Statement[ACCESS DB]

    How do you do this problem?
    Name (1st 25 characters only) with the column heading 'Theatre-Name'
    The concatenation of City (1st 10 characters only), a comma, a space, and State with the column heading 'Location'
    Unregistered Guest

Posting Permissions

  • You may not post new threads
  • You may 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