Query does not work in MS Access in CF

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default Query does not work in MS Access in CF

    I have this query that works fine in MS Access itself, but when I put it into
    my CFM page it does not work. The query is this:

    SELECT Products.Short_Description, Sizes.Size, Stock.StockCode,
    Products.Color_Code, Products.Piece, Stock.StitchCount
    FROM (Sizes INNER JOIN Products ON Sizes.Size_ID = Products.Size_ID) INNER
    JOIN (Stock INNER JOIN TempCart ON Stock.StockCode = TempCart.StockCode) ON
    Products.SKU = TempCart.SKU
    WHERE (((TempCart.CFID)=#Session.CFID#) AND
    ((TempCart.CFTOKEN)=#Session.CFToken#))

    The only thing that Access does is place double-quotes around the session
    variables. Otherwise this query is exactly the way it is in Access. I tried it
    with single quotes and no quotes (since these session variables are only
    numeric variables, they should not have quotes around them anyway). Can someone
    tell me what the problem is?

    Thanks,

    Bruce

    Botman63 Guest

  2. Similar Questions and Discussions

    1. Query use to work on CF 4.5
      I'm getting the following error "No value given for one or more required parameters." However this worked on CF 4.5 but not on CF 6.1. Any ideas? ...
    2. Query dosen't work
      hi friends i have a question i make this on application.cfm <cfapplication sessionmanagement="yes" name="UniqueName" ClientManagement="No"...
    3. Query used to work
      I have this one query it used to work in cfm 5.0 but now gives an error in cfm 6.0 <b>The query is</b> <CFQUERY NAME='ParentOrganization'...
    4. SQL/ASP.NET getting DATE to work in query
      I'm grabbing today's date with some ASP.net code: Dim Today As Date Today = Microsoft.VisualBasic.Today() I'm then trying to run a SQL query...
    5. Access 2002 PDFWriter VBA Code w/WinXP does not work like Access 2000
      I am trying to print an Access 2002 report (Windows XP OS) as a PDF. I had success with Access 2000 in a Windows 2000 environment, but as soon as I...
  3. #2

    Default Re: Query does not work in MS Access in CF

    Does it just not return what you expect ,or is it actually giving you an error message and, if so, what error are you seeing?

    Phil
    paross1 Guest

  4. #3

    Default Re: Query does not work in MS Access in CF

    Error:
    Error Executing Database Query.

    The error occurred in C:\Inetpub\wwwroot\Stitches\ShoppingCart.cfm: line 28

    26 : SELECT Products.Short_Description, Sizes.Size, Stock.StockCode,
    Products.Color_Code, Products.Piece, Stock.StitchCount
    27 : FROM (Sizes INNER JOIN Products ON Sizes.Size_ID = Products.Size_ID)
    INNER JOIN (Stock INNER JOIN TempCart ON Stock.StockCode = TempCart.StockCode)
    ON Products.SKU = TempCart.SKU
    28 : WHERE (((TempCart.CFID)=#Session.CFID#) AND
    ((TempCart.CFTOKEN)=#Session.CFToken#))
    29 : </cfquery>

    Botman63 Guest

  5. #4

    Default Re: Query does not work in MS Access in CF

    What happens if you replace #Session.CFID# and #Session.CFToken# with constants 202 and 75117395 respectively within your cfquery?

    Phil
    paross1 Guest

  6. #5

    Default Re: Query does not work in MS Access in CF

    New to coding but I would try this:

    WHERE (((TempCart.CFID)='#Session.CFID#') AND ((TempCart.CFTOKEN)='#Session.CFToken#'))

    James@nps Guest

  7. #6

    Default Re: Query does not work in MS Access in CF

    He already stated in the original post that I tried it with single quotes and no quotes...

    Phil
    paross1 Guest

  8. #7

    Default Re: Query does not work in MS Access in CF

    I would suspect Size is one of those keywords that cannot pass throught the
    ODBC interface (although Native Access still allows it). Either rename Size in
    the database or try surrounding with brackets Sizes..


    JMGibson3 Guest

  9. #8

    Default Re: Query does not work in MS Access in CF

    It was Size. Although it works fine in Access without brackets, I had to put brackets around it in CF. Thanks JM.
    Botman63 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