Skip to main content
Participant
December 18, 2011
Question

CFQuery Issues

  • December 18, 2011
  • 2 replies
  • 911 views

I'm trying to get data from a coldfusion database , with to start with, a very basic query.

I'm running this code :

<cfquery name="GetDatabaseSearchResults" DateSource="durhamli_durhamli">

SELECT *

FROM durhamli_DLI.SixthDLI

WHERE `Pre1917ServiceNumber` ='1'

</cfquery>

and getting this error :

The error occurred in ********* : line 8

6 :

7 : <body>

8 : <cfquery name="GetDatabaseSearchResults" DateSource="durhamli_durhamli">

9 :

10 : SELECT *

When I use the SQL direct on the database it pulls in a query fine.

When I check the DSN I get

Data Source Name Database Name Type Server / Port Created
durhamli_durhamli durhamli_DLI MYSQL5 localhost:3306

OK : The DNS durhamli_durhamli has connected to the database!

Can anyone tell me where I'm going wrong ?  (Ive not used CF for a good few years)

    This topic has been closed for replies.

    2 replies

    Inspiring
    December 18, 2011

    Is there a table named durhamli_DLI.SixthDLI in that database?  If so, you have to do something to escape the period.

    Next, why do you have left accents around Pre1917ServiceNumber?

    Inspiring
    December 18, 2011

    and getting this error :

    The error occurred in ********* : line 8

    6 :

    7 : <body>

    8 : <cfquery name="GetDatabaseSearchResults" DateSource="durhamli_durhamli">

    9 :

    10 : SELECT *

    You didn't quote the actual error message in your post.  So it's difficult to say.

    --

    Adam

    cis01Author
    Participant
    December 18, 2011

    Thanks - slight oversight.

    The actual error message is:

    Attribute validation error for tag CFQUERY.

    It does not allow the attribute(s) DATESOURCE. The valid attribute(s) are BLOCKFACTOR,CACHEDAFTER,CACHEDWITHIN,CONNECTSTRING,DATASOURCE,DBNAME,DBPOOL,

    DBSERVER,DBTYPE,DEBUG,MAXROWS,NAME,ORMOPTIONS,PASSWORD,PROVIDER,PROVIDERDSN,RESULT,SQL,TIMEOUT,USERNAME.

    Inspiring
    December 18, 2011

    You spelled datasource incorrectly.  My earlier comments still apply.