• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Queries not working in CF......

Participant ,
May 02, 2012 May 02, 2012

Copy link to clipboard

Copied

Good morning all,

I have this query that I can run in SQL Server Management Studio but it will not run in ColdFusion. Do I need to put in a stored procedure to run the below code?

<cffunction name="itmChk" returntype="query">

    <cfargument name="searchPO" required="yes">

    <cfquery name="itemCheck" datasource="#REQUEST.datasource#">

    select ordno, itnbr, house, poisq, blcod, b_blksq, cmpdt, itdsc, engno, itcls, duedt, umord, qtyor, stkqt, staic, vndnr, vname, b_relqt, b_reldt, b_stkqt, b_staic, pitd1, pitd2, duedate

        from recvTemp t

        where t.ordno = '#arguments.searchPO#'  and not exists(select *

                                         from recvLogTest r

                                         where t.ordno = r.ordno and t.itnbr = r.itnbr)

    </cfquery>

    <cfreturn itemCheck>

    </cffunction>

Thanks for any help!!!

DJkhalif

Views

2.2K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Enthusiast , May 04, 2012 May 04, 2012

You might also use SQL Profiler to view the query that is being excuted.

"SQL Server Profiler Step by Step"

http://www.codeproject.com/Articles/21371/SQL-Server-Profiler-Step-by-Step

"Getting ColdFusion SQL Statements from SQL Server Trace"

http://www.petefreitag.com/item/674.cfm

Votes

Translate

Translate
LEGEND ,
May 02, 2012 May 02, 2012

Copy link to clipboard

Copied

What do you mean "will not run"?

Recommend you read this:

http://forums.adobe.com/thread/607238

--

Adam

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 02, 2012 May 02, 2012

Copy link to clipboard

Copied

Adam,

Thanks for the tip on how to post. What I mean by will not run, the query does not return any values using a dump or with cfoutput. There are no errors and when executed in SSMS, there are values. I have another query doing the same thing. I've restarted the CF9 Application Service, I've run them in dumps and I've remote the Application.cfc #REQUEST.datasource# and hardcoded the db name. I've even taken one of them out of the cfc and placed directly in the page, nothing happens. Tags: cfquery, coldfusion9,cfc.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 02, 2012 May 02, 2012

Copy link to clipboard

Copied

I would check to see what value is being passed to the query and even email yourself a dump of the query after it runs (which will include the actual query it is running). Then copy and paste that into SSMS and see if it returns records.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
May 04, 2012 May 04, 2012

Copy link to clipboard

Copied

You might also use SQL Profiler to view the query that is being excuted.

"SQL Server Profiler Step by Step"

http://www.codeproject.com/Articles/21371/SQL-Server-Profiler-Step-by-Step

"Getting ColdFusion SQL Statements from SQL Server Trace"

http://www.petefreitag.com/item/674.cfm

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 04, 2012 May 04, 2012

Copy link to clipboard

Copied

LATEST

JR,

After running the Trace, I noticed that my cfinvokeargument value was incorrect. The value was passing a string instead of a variable. value="URL.name" instead of  value="#URL.name#".

Thanks,

djkhalif

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation