Professional Web Applications Themes

CFQUERY problem - Coldfusion Database Access

I am passing three values from a form to a search application, miles, zip, and day. I want to test for database entries in which the day's field is not null and the zip value is contained within one of three fields (5miles, 10miles, 25miles) which are text strings of all zip codes within a certain mileage radius of a field called ZipCode. My CFQUERY: <CFQUERY DATASOURCE="DATA" NAME="SearchResults"> SELECT * FROM Places WHERE (#day# IS NOT NULL) AND (#miles#miles LIKE '%#zip#%') </CFQUERY> passes all the correct values into the .cfm module, but produces the following error message: [Macromedia][SequeLink JDBC Driver][ODBC ...

  1. #1

    Default CFQUERY problem

    I am passing three values from a form to a search application, miles, zip, and
    day. I want to test for database entries in which the day's field is not null
    and the zip value is contained within one of three fields (5miles, 10miles,
    25miles) which are text strings of all zip codes within a certain mileage
    radius of a field called ZipCode. My CFQUERY:

    <CFQUERY DATASOURCE="DATA" NAME="SearchResults">
    SELECT *
    FROM Places
    WHERE (#day# IS NOT NULL) AND (#miles#miles LIKE '%#zip#%')
    </CFQUERY>

    passes all the correct values into the .cfm module, but produces the following
    error message:

    [Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft
    Access Driver] Syntax error (missing operator) in query expression '(Thursday
    IS NOT NULL) AND (5miles LIKE '%08610%')'.

    Any suggestions?

    moonroach1 Guest

  2. #2

    Default Re: CFQUERY problem

    Guessing here, but it is probably the mileage radius columns. Because those
    column names begin with a number, the database probably sees the number "5"
    and tries to treat the column name as if it were a numeric value (ex. 5 + 2)
    rather than a column name. Try changing the name so that it does not start
    with a number: Radius5Miles, Radius10Miles, etc. I not too sure about the
    rest of the table design ...



    mxstu Guest

  3. #3

    Default CFQUERY problem

    Hi everyone.

    I have a problem when I try to use Autodesk MapGuide LiteView or -"- -"-
    Author to
    use an example file "Sample_World.mwf"'. Exactly the problem comes out when
    I'm asking the "REPORT" for
    "capitals" from database which Cold Fusion can't find. Database is called
    "Sample_World.cfm".

    Linking URL's to file are assetted correctly in MapGuide Author and so on....
    You can see the error announcement below which comes out when I'm asking the
    "REPORT":

    Welcome to the sample world data set for Autodesk MapGuide.


    --------------------------------------------------------------------------------

    Error Occurred While Processing Request
    Error Diagnostic Information
    ODBC Error Code = IM002 (Data source not found and no default driver specified)

    [Microsoft][ODBC Driver Manager] Data source 'SAMPLE_WORLD' not found and no
    default driver specified

    Hint: In order to use ODBC data sources with Cold Fusion you must create the
    data source using the Data Sources page of the Cold Fusion Administrator. In
    addition, if you are running under Windows NT you must make sure that the Data
    Source is created as a System DSN in order for it to be available to ColdFusion.

    The error occurred while processing an element with a general identifier of
    (CFQUERY), occupying doent position (10:1) to (10:69).

    Date/Time: 07/19/05 14:53:55
    Browser: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 4.0)
    Remote Address: MyServerIPaddress

    Because of the security reasons, I don't have DNS service in my server and
    when I checked:
    "data source using the Data Sources page of the Cold Fusion Administrator", I
    could find problems in local server proberties
    <=> SQL Server, but I think that isn't maybe so big problem, because I use
    Cold Fusion and other programs only locally..???
    As the error announcement said: CFQUERY error... So the problem must be in
    Cold Fusion software or it's setup's or
    something.. I have used these programs for a very short time and I would
    really appreciate Your help.

    These are the programs I use:
    * Win NT
    * Cold Fusion Server 4.5
    * Allaire JRun 2.3.3
    * MapGuide 5 (and some other MapGuide programs, but expecially:)
    * MapGuide Author (and)
    * MapGuide LiteView

    Please, help me to solve this problem.

    Ville


    Ville M. Guest

  4. #4

    Default Re: CFQUERY problem

    I solved the problem. I able to associate the database to the example file with
    Cold Fusion Administrator (Sample_World.mdb). Database was under
    MapGuideServer5 -file, so I didn't recognize it before..

    All this was new to me and I'm glad that I could solve the problem.

    Ville

    Ville M. Guest

  5. #5

    Default Re: cfquery problem

    Might another query in another thread execute in between the insert and the
    select statements, leaving me with the wrong IDENTITY? Is this possible
    within a single cfquery?
    Would using cftransaction be useful / necessary?

    Also, the SET NOCOUNT ON line is to prevent the database server from saying:
    "N rows sere affected."



    BiSaisei Guest

Similar Threads

  1. unusual cfquery problem
    By feral99 in forum Coldfusion - Advanced Techniques
    Replies: 0
    Last Post: May 9th, 12:13 AM
  2. double single quote problem in cfquery
    By Bigio in forum Coldfusion Database Access
    Replies: 7
    Last Post: April 25th, 09:46 PM
  3. <cfquery> syntax problem
    By samb1 in forum Macromedia ColdFusion
    Replies: 1
    Last Post: April 7th, 08:33 PM
  4. CFQUERY with IF THEN ELSE
    By mike2004 in forum Coldfusion Database Access
    Replies: 10
    Last Post: March 4th, 03:20 PM
  5. Javascript and CFquery problem
    By Matt McSpirit in forum Macromedia ColdFusion
    Replies: 1
    Last Post: March 1st, 05:12 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