Database Query Error

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

  1. #1

    Default Database Query Error

    Hello..I have a small CF library app setup using a MSACCESS database. All
    depts can be searched no problem except one which give me this error:
    Processing Request Error Executing Database Query. [MERANT][SequeLink JDBC
    Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] Syntax error
    (missing operator) in query expression '1=1 and PDFNumber in
    ('6100007','6100006','6100005','6100004','6100003' ,'6100002','6072006','60720039
    ','60720038','60720036 ','60720033') and Department = 'Women &
    Children's''. The error occurred in E:\Results.cfm: line 61 59 : </cfif>
    60 : 61 : <cfquery name='SearchList' datasource='#ODBCdsn#' dbtype='ODBC'> 62
    : select * 63 : from PDFFiles
    --------------------------------------------------------------------------------
    SQL select * from PDFFiles where 1=1 and PDFNumber in
    (&amp;apos;6100007&amp;apos;,&amp;apos;6100006&amp ;apos;,&amp;apos;6100005&amp;a
    pos;,&amp;apos;6100004&amp;apos;,&amp;apos;6100003 &amp;apos;,&amp;
    apos;6100002&amp;apos;,&amp;apos;6072006&amp;apos; ,&amp;apos;60720039&amp;apos;,
    &amp;apos;60720038&amp;apos;,&amp;apos;60720036&am p;apos;,
    &amp;apos;60720033&amp;apos;) and Department = &amp;apos;Women &amp;
    Children&amp;apos;s&amp;apos; DATASOURCE pdflibrary VENDORERRORCODE
    -3100 SQLSTATE 42000 Text whats the dealio? any ideas?

    BigNicko7 Guest

  2. Similar Questions and Discussions

    1. Error Executing Database Query
      I have a website, which is visited by 18.000 unique users a day, who view almost 900.000 pages As you can see, one user views a lot of pages....
    2. Error Executing Database Query.
      The error occurred in C:\CFusionMX7\wwwroot\CFIDE\gettingstarted\tutorial\index.cfm: line 2 2 : <cfquery name="atrwork"...
    3. error executing database query on login
      I've noticed we started getting this message when you try to Login to the website. We have recently just installed the CF standard edition 7.0 We...
    4. another Error executing database query
      Just when I thought I had all my forms finely tuned, I get the error below, which has me stumped (using DrmWeaver 2004, CF7, mysql): Error...
    5. Error Executing Access Database Query
      The query works in 5, chokes in MX7 Error Message: Invalid SQL statement; expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT', or 'UPDATE'. ...
  3. #2

    Default Database query error

    Hello all. I am working through a tutorial in a book (Dreamweaver MX 2004 and
    Databases, by Sean Nicholson) and I am making an intranet website using
    Dreamweaver MX (I don't have 2004) and Coldfusion MX. I've followed the
    instructions exactly and gone through it twice, but I getting the same error. I
    have a page that sucessfully allows me to add an employee to a database. The
    page that I made to allow me search the database for that employee's record
    works properly. The page that returns the query works fine. The page that let's
    me update the database record is what gives me the error. When I try to change
    something in the record and select "update," I get an error from Coldfusion
    that tells me that it wasn't able to execute the database query. Here is the
    message for you guys to look at:

    The Error Occurred in C:\Inetpub\wwwroot\KrystalClear-CF\edit_employee.cfm:
    line 78

    76 : </cfif>
    77 : WHERE EmployeeID='#FORM.EmployeeID#'
    78 : </cfquery>
    79 : <cflocation url="employee_updated.cfm">
    80 : </cfif>

    Now, line 78 just seems to be the end of the coldfusion query to my untrained
    eyes, but there has to be something else. Can anyone tell me what could
    possibly be wrong? Thanks a bunch.
    Ben


    byutennismenace Guest

  4. #3

    Default Re: Database query error

    You'll need to post the complete error message and the entire query along with any relevant code.
    Tulsa Guest

  5. #4

    Default Re: Database query error

    Sorry about that. Here's the whole error message:

    Error Occurred While Processing Request
    Error 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:\Inetpub\wwwroot\KrystalClear-CF\edit_employee.cfm:
    line 78

    76 : </cfif>
    77 : WHERE EmployeeID='#FORM.EmployeeID#'
    78 : </cfquery>
    79 : <cflocation url="employee_updated.cfm">
    80 : </cfif>




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

    SQL UPDATE tbHR SET LastName= 'Grierson' , FirstName= 'William' , HomeAdd=
    'XXXXXXXXX' , City= 'XXXX' , HomeState= 'Id' , Zip= 'XXXXX' , HomePhone=
    'XXXXXXXXXX' , Department= 'IS' , Title= NULL , Extension= 'x12' , HireDate=
    '2005-01-01 00:00:00.0' , EditPages= 0 WHERE EmployeeID='000-001-100'
    DATASOURCE connKrystalClearCF
    VENDORERRORCODE -3030
    SQLSTATE 22018

    As for relevant code, I believe that most of the code is okay up until that
    point, but I'll give you what there is in a summarized form by cutting out the
    redundant part:

    <cfparam name="URL.EmployeeID" default="1">
    <cfset CurrentPage=GetFileFromPath(GetTemplatePath())>
    <cfif IsDefined("FORM.MM_UpdateRecord") AND FORM.MM_UpdateRecord EQ "form1">
    <cfquery datasource="connKrystalClearCF">
    UPDATE tbHR SET LastName=
    <cfif IsDefined("FORM.LastName") AND #FORM.LastName# NEQ "">
    '#FORM.LastName#'
    <cfelse>
    NULL
    </cfif>
    , FirstName=
    <cfif IsDefined("FORM.FirstName") AND #FORM.FirstName# NEQ "">
    '#FORM.FirstName#'
    <cfelse>
    NULL
    </cfif>
    byutennismenace Guest

  6. #5

    Default Re: Database query error

    That error is usually generated when quotes are used around a variable that is
    going into a table field that is type number/integer, date, or autoNumber. Say
    you have a date field then it would be set date = #form.date#, NOT set date =
    '#form.date#' Same goes for number/integer fields and autonumbers. You should
    look at the all variables and the respective datatypes they are going into.
    Also I noticed you are entering a 1 or 0 into a field, if this is a yes/no
    field, you might try field_name = yes



    Tulsa Guest

  7. #6

    Default Re: Database query error

    since it showed you that the line number was teh one following employeeID, my
    guess is that emplyeeID is actually a number going into a numerical field - but
    you put quotes around it which turns it into a string.

    In SQL server this doesn't matter, but in MS Access it does.



    SafariTECH Guest

  8. #7

    Default Re: Database query error

    That was it, SafariTECH. Thanks a bunch. It was actually dreamweaver that made it a string for some reason.

    Anyway, thanks everyone for your help. It is appreciated.
    Ben
    byutennismenace 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