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

  1. #1

    Default CreateODBCDate

    I am in the process of moving a website from one server to another. The old
    server was running Coldfusion 6.1, and the new server is running 7.0. There is
    an SQL Server database integrated with the site and I am having trounle
    connecting to it on the new server. I have the data source all setup in
    Coldfusion Administrator. The error I get is on multiple pages:

    Error Executing Database Query.
    [Macromedia][SQLServer JDBC Driver][SQLServer]Invalid object name 'schedule'.
    (it's not always 'schedule', there are other object names that come up for
    other pages)

    The error always occurs on a line that has CreateODBCDate in it. Here's an
    example of one (the error is on line 18):

    11<cfset publicClause= "AND ((schedule.RegOnline)="& public_web &")">
    12
    13<cfquery datasource="test_for_sql" name="d_upcoming"
    cachedwithin=#CreateTimeSpan(0,6,0,0)#>
    14 SELECT DISTINCT eventName, event.eventID
    15 FROM schedule, event
    16 WHERE schedule.eventID= event.eventID AND RegOnline = 1 AND (schedule.date
    BETWEEN
    17 #CreateODBCDate(startDate)# AND
    18 #CreateODBCDate(endDate)#) #publicClause#
    19 ORDER BY event.eventName ASC
    20</cfquery>

    I don't know if this is an issue with the new Coldfusion version, or if it has
    something to do with the new server being able to talk to the data source.
    Please, any ideas may help.

    Thanks,
    Andrew

    atkearns Guest

  2. Similar Questions and Discussions

    1. Usage of CreateODBCDate
      Hi, Is it correct to use CreateODBCDate or CreateODBCDateTime when you are actually connecting using JDBC drivers? Or should these be only used...
  3. #2

    Default Re: CreateODBCDate

    Could be your variables.

    Dump #CreateODBCDate(startDate)# AND #CreateODBCDate(endDate)#

    and see if you get anything. If it works, the problem is something else.

    Originally posted by: atkearns
    I am in the process of moving a website from one server to another. The old
    server was running Coldfusion 6.1, and the new server is running 7.0. There is
    an SQL Server database integrated with the site and I am having trounle
    connecting to it on the new server. I have the data source all setup in
    Coldfusion Administrator. The error I get is on multiple pages:

    Error Executing Database Query.
    [Macromedia][SQLServer JDBC Driver][SQLServer]Invalid object name 'schedule'.
    (it's not always 'schedule', there are other object names that come up for
    other pages)

    The error always occurs on a line that has CreateODBCDate in it. Here's an
    example of one (the error is on line 18):

    11<cfset publicClause= "AND ((schedule.RegOnline)="& public_web &")">
    12
    13<cfquery datasource="test_for_sql" name="d_upcoming"
    cachedwithin=#CreateTimeSpan(0,6,0,0)#>
    14 SELECT DISTINCT eventName, event.eventID
    15 FROM schedule, event
    16 WHERE schedule.eventID= event.eventID AND RegOnline = 1 AND (schedule.date
    BETWEEN
    17 #CreateODBCDate(startDate)# AND
    18 #CreateODBCDate(endDate)#) #publicClause#
    19 ORDER BY event.eventName ASC
    20</cfquery>

    I don't know if this is an issue with the new Coldfusion version, or if it has
    something to do with the new server being able to talk to the data source.
    Please, any ideas may help.

    Thanks,
    Andrew



    Dan Bracuk Guest

  4. #3

    Default Re: CreateODBCDate

    It still doesn't work.. this time the error reads:

    Error Executing Database Query.
    [Macromedia][SQLServer JDBC Driver][SQLServer]Line 3: Incorrect syntax near
    '!'.

    Here's how I commented out those lines:

    WHERE schedule.eventID= event.eventID AND RegOnline = 1 AND (schedule.date
    <!--BETWEEN
    #CreateODBCDate(startDate)# AND
    #CreateODBCDate(endDate)#-->) #publicClause#

    atkearns Guest

  5. #4

    Default Re: CreateODBCDate

    You used an HTML comment. You have to use a Coldfusion comment.

    <!--- coldfusion comment --->
    <!-- html comment -->
    Kronin555 Guest

  6. #5

    Default Re: CreateODBCDate

    Oops sorry.
    OK w/ the correct tag it still gives me this error for the same line:

    Error Executing Database Query.
    [Macromedia][SQLServer JDBC Driver][SQLServer]Incorrect syntax near the
    keyword 'AND'.



    atkearns Guest

  7. #6

    Default Re: CreateODBCDate

    Look at your query here:
    SELECT DISTINCT eventName, event.eventID
    FROM schedule, event
    WHERE schedule.eventID= event.eventID AND RegOnline = 1 AND (schedule.date
    BETWEEN
    #CreateODBCDate(startDate)# AND
    #CreateODBCDate(endDate)#) #publicClause#
    ORDER BY event.eventName ASC

    If you comment out what you listed above, you get:
    SELECT DISTINCT eventName, event.eventID
    FROM schedule, event
    WHERE schedule.eventID= event.eventID AND RegOnline = 1 AND (schedule.date
    BETWEEN ) #publicClause#
    ORDER BY event.eventName ASC

    This isn't a syntactically-correct query. If you're going to comment out the
    date stuff, comment it all out. Also, keep in mind that your publicClause
    string starts with an AND, so you want to make sure that your query doesn't
    result in an "AND AND" condition, as that will throw an error as well...

    Kronin555 Guest

  8. #7

    Default Re: CreateODBCDate

    Why are you starting your comment after schedule.date? Now your query looks
    like this:

    1<cfset publicClause= "AND ((schedule.RegOnline)="& public_web &")">
    12
    13<cfquery datasource="test_for_sql" name="d_upcoming"
    cachedwithin=#CreateTimeSpan(0,6,0,0)#>
    14 SELECT DISTINCT eventName, event.eventID
    15 FROM schedule, event
    16 WHERE schedule.eventID= event.eventID AND RegOnline = 1 AND (schedule.date)
    #publicClause#
    19 ORDER BY event.eventName ASC
    20</cfquery>

    Which is nonesense (the AND (schedule.date) part)

    Shouldn't you start your comment before AND (schedule.date) ? <!---AND
    (schedule.date)

    Phil

    paross1 Guest

  9. #8

    Default Re: CreateODBCDate

    What you thought you heard me say is different than what I thought I told you
    to try. If I may, I'll rephrase my suggestion.

    Put this code right before your query. The if the variables display, the
    problem is something else.

    <cfdump var="start date odbc is #CreateODBCDate(startDate)# and end date odbc
    is #CreateODBCDate(endDate)#">

    Originally posted by: atkearns
    It still doesn't work.. this time the error reads:

    Error Executing Database Query.
    [Macromedia][SQLServer JDBC Driver][SQLServer]Line 3: Incorrect syntax near
    '!'.

    Here's how I commented out those lines:

    WHERE schedule.eventID= event.eventID AND RegOnline = 1 AND (schedule.date
    <!--BETWEEN
    #CreateODBCDate(startDate)# AND
    #CreateODBCDate(endDate)#-->) #publicClause#



    Dan Bracuk 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