Join Query works in access but not via ColdFusion

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

  1. #1

    Default Join Query works in access but not via ColdFusion

    I have a query I built with the query builder in Access and through access it
    works fine.
    here is the query:
    SELECT
    appUsers.AppId,
    LAWSON_SHC_EMPLOYEE_V.FIRST_NAME,
    LAWSON_SHC_EMPLOYEE_V.EMPLOYEE,
    LAWSON_SHC_EMPLOYEE_V.LAST_NAME
    FROM
    appUsers
    INNER JOIN
    LAWSON_SHC_EMPLOYEE_V
    ON appUsers.EmpId = LAWSON_SHC_EMPLOYEE_V.EMPLOYEE
    WHERE (((appUsers.AppId)=111) AND ((LAWSON_SHC_EMPLOYEE_V.EMPLOYEE)=18796)
    AND ((LAWSON_SHC_EMPLOYEE_V.LAST_NAME)="SMITH"));

    again this works fine in access so then I make slight modifications to imbed
    it into my ColdFusion template

    SELECT
    LAWSON_SHC_EMPLOYEE_V.FIRST_NAME,
    LAWSON_SHC_EMPLOYEE_V.EMPLOYEE,
    LAWSON_SHC_EMPLOYEE_V.LAST_NAME,
    appUsers.AppId
    FROM
    appUsers
    INNER JOIN
    LAWSON_SHC_EMPLOYEE_V
    ON
    appUsers.EmpId = LAWSON_SHC_EMPLOYEE_V.EMPLOYEE
    WHERE
    LAWSON_SHC_EMPLOYEE_V.EMPLOYEE = <cfqueryparam value="#form.empID#"
    cfsqltype="cf_sql_integer"> AND
    LAWSON_SHC_EMPLOYEE_V.LAST_NAME= <cfqueryparam value="#ucase(form.Lname)#"
    cfsqltype="cf_sql_char"> AND
    appUsers.AppId = <cfqueryparam value="111" cfsqltype="cf_sql_integer">

    This one doesnt work. before I added the CfqueryParams I got a 2 few
    parameters expected 2. After adding the CfqueryParams the errors stopped but I
    get an empty recordset when I should get 1 row back. To make matters even more
    interesting when I change the INNER JOIN to a LEFT JOIN it seems to work. What
    bothers me the most is that I cannot explain why it will work as left join but
    not inner, and my boos wont le tthe app go live untill I can.

    any insight will be appreciated.

    Thanks Ron

    albatross07 Guest

  2. Similar Questions and Discussions

    1. Lotus Notes Query with ColdFusion - Access
      Is it possible to access/query Lotus Notes with Coldfusion? How can I create the DSN in Coldfusion Administrator Successfully? I have searched...
    2. MS Access Union Join not working w/ Coldfusion MX
      Hope this makes sense. I'm new to this and trying to figure it out. I'm having problems getting a union join to work w/ Coldfusion MX 6.1. I have...
    3. Query Works in ACCESS DB but not on Front End
      Okay...i am trying to run a query to view people that are overdue in there medical appts. i did the <cfoutput> in place of <cfquery> and ran the...
    4. Working through an update query Coldfusion/Access
      I'm working on an update query for a class registration system in ColdFusion 6.1 running against an Access 2000 datasource. In short what I need to...
    5. BCP query out executed by xp_cmdshell works fine from query analyzer but fails from VB Component
      Hi all, I have a stored procedure which returns a vast number of record and i have to write the output into a csv file. I'm using BCP utility to...
  3. #2

    Default Re: Join Query works in access but not via ColdFusion

    albatross07 wrote:
    > I have a query I built with the query builder in Access and through
    access it
    > works fine.
    > here is the query:
    > SELECT
    > appUsers.AppId,
    > LAWSON_SHC_EMPLOYEE_V.FIRST_NAME,
    > LAWSON_SHC_EMPLOYEE_V.EMPLOYEE,
    > LAWSON_SHC_EMPLOYEE_V.LAST_NAME
    > FROM
    > appUsers
    > INNER JOIN
    > LAWSON_SHC_EMPLOYEE_V
    > ON appUsers.EmpId = LAWSON_SHC_EMPLOYEE_V.EMPLOYEE
    > WHERE (((appUsers.AppId)=111) AND
    ((LAWSON_SHC_EMPLOYEE_V.EMPLOYEE)=18796)
    > AND ((LAWSON_SHC_EMPLOYEE_V.LAST_NAME)="SMITH"));
    >
    > again this works fine in access so then I make slight modifications
    to imbed
    > it into my ColdFusion template
    >
    > SELECT
    > LAWSON_SHC_EMPLOYEE_V.FIRST_NAME,
    > LAWSON_SHC_EMPLOYEE_V.EMPLOYEE,
    > LAWSON_SHC_EMPLOYEE_V.LAST_NAME,
    > appUsers.AppId
    > FROM
    > appUsers
    > INNER JOIN
    > LAWSON_SHC_EMPLOYEE_V
    > ON
    > appUsers.EmpId = LAWSON_SHC_EMPLOYEE_V.EMPLOYEE
    > WHERE
    > LAWSON_SHC_EMPLOYEE_V.EMPLOYEE = <cfqueryparam value="#form.empID#"
    > cfsqltype="cf_sql_integer"> AND
    > LAWSON_SHC_EMPLOYEE_V.LAST_NAME= <cfqueryparam
    value="#ucase(form.Lname)#"
    > cfsqltype="cf_sql_char"> AND
    > appUsers.AppId = <cfqueryparam value="111"
    cfsqltype="cf_sql_integer">
    >
    > This one doesnt work. before I added the CfqueryParams I got a 2
    few
    > parameters expected 2. After adding the CfqueryParams the errors
    stopped but I
    > get an empty recordset when I should get 1 row back. To make matters
    even more
    > interesting when I change the INNER JOIN to a LEFT JOIN it seems to
    work. What
    > bothers me the most is that I cannot explain why it will work as left
    join but
    > not inner, and my boos wont le tthe app go live untill I can.
    >
    > any insight will be appreciated.
    >
    > Thanks Ron
    Just a thought - When passing text in a SQL statement to an ODBC or
    JDBC driver, you must use single quotation marks. If you use double
    quotation marks, the parser treats the first double quotation mark as a
    statement terminator, ignoring all the text after it.

    javabuzz Guest

  4. #3

    Default Re: Join Query works in access but not via ColdFusion

    Hi

    you are saying the same query is working fine in the ms-access, then for
    testing just execute the same query from the cfquery with the same values.
    then check out is there any problem, if it works fine then replaces the values
    with cf varaibles.

    or else
    just display the query before executing it in cf. copy that query executed
    it in the ms-access thensee how many records it is returning.
    :cool;

    vkunirs 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