Outputting data using date field

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

  1. #1

    Default Outputting data using date field

    I have a query that outputs the result based on date. I m writing it as:

    select * from apna where assignedto='#form.assignedto#' and
    updateddate='#form.thedate#'

    The query looks like this with variables:

    select * from apna where assignedto='Dave' and updateddate='4-19-2006'

    It is showing no result. What am I doing wrong here?

    DDhillon Guest

  2. Similar Questions and Discussions

    1. Date comparison in a text data field
      I have a database column field defined as a text. I store dates in format: dd/mm/yyyy. The user passes a Start date search string in the same...
    2. Help Outputting data from Access database
      I need to outputa grouped set of data from an Access database using CF. Basically a Person can be associated to many positions, programs and...
    3. Comparing current field data with last entry for field
      Hi. I have a form that is inserting sales data on a daily basis. I have a field named "RoundTOTAL" which is the total sales for the day rounded to...
    4. Converting a text field to a date field - FM6
      I need to convert a Text field containing both auto and manually entered dates over to a Date field. The records that were autoentered move over...
    5. Linking date field to text field entry
      Is there a way to setup a date field that will automatically enter the date when any information is entered into a field next to it?
  3. #2

    Default Re: Outputting data using date field

    A couple of questions.

    1. What is your database type?
    2. What is the data type of the updateddate column?
    3. What is your data souce connection type (ODBC, JDBC, etc.)?
    4. What is the version of ColdFusion?

    Phil

    paross1 Guest

  4. #3

    Default Re: Outputting data using date field

    1. What is your database type?
    MS Access

    2. What is the data type of the updateddate column?
    Date/Time

    3. What is your data souce connection type (ODBC, JDBC, etc.)?
    ODBC

    4. What is the version of ColdFusion?
    Coldfusion MX

    DDhillon Guest

  5. #4

    Default Re: Outputting data using date field

    Try using createodbcdatetime() on your form.thedate variable within the query
    to convert it to a date/time object.

    select *
    from apna
    where assignedto='#form.assignedto#'
    and updateddate=#createodbcdatetime(form.thedate)#

    Phil


    paross1 Guest

  6. #5

    Default Re: Outputting data using date field

    Thank you Phill but I m still getting this error:

    Error Executing Database Query.
    Too few parameters. Expected 1.

    The Error Occurred in E:\ApnaCalls\callstrack.cfm: line 40

    38 : <td>Size</td>
    39 : <td>Date Called</td>
    40 : </tr>
    41 : <cfoutput query="gettrack">
    42 : <tr>




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

    SQL select * from apna where assignedto='Sukh' and updateddate={ts
    '2006-04-19 00:00:00'}
    DATASOURCE apnacalls
    VENDORERRORCODE -3010
    SQLSTATE 07002

    The way date is stored in database is like : 4/19/2006

    Could that be a reason?

    DDhillon Guest

  7. #6

    Default Re: Outputting data using date field

    I thought that you said that it was a date/time object. What happens if you do
    this?

    select *
    from apna
    where assignedto='#form.assignedto#'
    and CDate(updateddate) = #createodbcdate(form.thedate)#

    Phil


    paross1 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