Professional Web Applications Themes

Variable Creation Question - Macromedia ColdFusion

I'm trying to creat a variable which will be a combination of two fields in my table, ID and IDsub (ID is a number, IDsub is text). I tried using the Select *, WHERE with AND = and get the following error message: rror Executing Database Query. [MERANT][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression. The Error Occurred in C:\CFusionMX\wwwroot\GetEmployee\MCreationUpdate.c fm: line 8 6 : 7 : WHERE MeterCreationPCNno.ID AND MeterCreationPCNno.IDsub = #URL.ID# 8 : </cfquery> 9 : <cfquery name='qRequestNo' datasource='MeterCreationfrm'> 10 : SELECT MeterCreationPCNno.ID, MeterCreationPCNno.IDsub, MeterCreationPCNno.DateSubmitted FROM MeterCreationPCNno -------------------------------------------------------------------------------- SQL SELECT * FROM MeterCreationPCNno ...

  1. #1

    Default Variable Creation Question

    I'm trying to creat a variable which will be a combination of two fields in my
    table, ID and IDsub (ID is a number, IDsub is text). I tried using the Select
    *, WHERE with AND = and get the following error message: rror Executing
    Database Query. [MERANT][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC
    Microsoft Access Driver] Data type mismatch in criteria expression. The
    Error Occurred in C:\CFusionMX\wwwroot\GetEmployee\MCreationUpdate.c fm: line 8
    6 : 7 : WHERE MeterCreationPCNno.ID AND MeterCreationPCNno.IDsub = #URL.ID#
    8 : </cfquery> 9 : <cfquery name='qRequestNo' datasource='MeterCreationfrm'> 10
    : SELECT MeterCreationPCNno.ID, MeterCreationPCNno.IDsub,
    MeterCreationPCNno.DateSubmitted FROM MeterCreationPCNno
    --------------------------------------------------------------------------------
    SQL SELECT * FROM MeterCreationPCNno WHERE MeterCreationPCNno.ID AND
    MeterCreationPCNno.IDsub = 180 DATASOURCE MeterCreationfrm VENDORERRORCODE
    -3030 SQLSTATE 22018 Can someone please tell me how to combine these two
    fields to create a single variable that will go into a form???? Many thanks
    for your help and time.:-)

    FusionRed Guest

  2. #2

    Default Re: Variable Creation Question

    You can't combine the 2 fields together like that. Since IDsub is text, put
    the value in quotes. You have to do this:

    WHERE MeterCreationPCNno.ID = #URL.ID# AND MeterCreationPCNno.IDsub =
    '#URL.ID#'


    eastinq Guest

  3. #3

    Default Re: Variable Creation Question

    I can tell you why your SQL is failing. You want

    SELECT *
    FROM MeterCreationPCNno
    WHERE MeterCreationPCNno.ID = 180 AND
    MeterCreationPCNno.IDsub = 180

    or, if IDsub is a text field, then:

    SELECT *
    FROM MeterCreationPCNno
    WHERE MeterCreationPCNno.ID = 180 AND
    MeterCreationPCNno.IDsub = '180'

    This will, of course, return two columns (or more, I don't know the design of
    your table). If you need to, you can cat them together like:

    <cfset IDcat = ID & IDsub>

    JR


    jonwrob Guest

  4. #4

    Default Re: Variable Creation Question

    Let me add some information to this post: the URL being passed is the ID and I
    need to understand how to pass two fields for the URL (I have two primary key
    fields in my table to make the unique record). Currently the URL being passed
    is: <a
    href='MCreationUpdate.cfm?ID=#qGetMCurl.ID#'>#qGet MCurl.ID#</a>&amp;nbsp;#IDSub#
    I need to have both fields (ID and IDsub) passed in order to get the unique
    url. Any help is greatly appreciated. FusionRed

    FusionRed Guest

  5. #5

    Default Re: Variable Creation Question

    MCreationUpdate.cfm?ID=#qGetMCurl.ID#&IDSub=#IDSub #

    Then, on your "action" page, you will have two URL variables, url.ID and
    url.IDSub

    SELECT *
    FROM MeterCreationPCNno
    WHERE MeterCreationPCNno.ID = #url.ID#
    AND MeterCreationPCNno.IDsub = #url.IDSub#

    (NOTE: Make sure to enclose the variables in single quotes if the ID and/or
    IDSub columns in the database are text instead of numeric.)

    Phil

    paross1 Guest

  6. #6

    Default Re: Variable Creation Question

    xfile.cfm?ID=#qGetMCurl.ID#&IDSub=#IDSub#

    ....
    WHERE MeterCreationPCNno.ID = #URL.ID# AND MeterCreationPCNno.IDsub = '#URL.IDSub#'

    eastinq Guest

Similar Threads

  1. Question about new page creation from template
    By Aaron in forum Macromedia Contribute General Discussion
    Replies: 0
    Last Post: January 27th, 01:51 AM
  2. question: how to preload data and excute table creation scripts
    By Michael Fuhr in forum PostgreSQL / PGSQL
    Replies: 1
    Last Post: December 11th, 07:32 PM
  3. Map Creation Question
    By David_McMahon@adobeforums.com in forum Adobe Illustrator Windows
    Replies: 5
    Last Post: May 13th, 04:30 PM
  4. Array creation with a existing variable
    By Ravi Malghan in forum PERL Beginners
    Replies: 7
    Last Post: January 26th, 03:57 PM
  5. Global variable question question
    By Jason Giangrande in forum PHP Development
    Replies: 3
    Last Post: July 23rd, 08:27 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