Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Trying to update MS Access table with datetime column in Where clasuse

Trying to update MS Access table with datetime column in Where clasuse

Scheduled Pinned Locked Moved Database
helpquestionannouncement
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    pnslcs
    wrote on last edited by
    #1

    I am trying to update a MS ACCESS table that has a column defined as a datetime type. The update looks like: string updateSQL = "update Perform " + " set venueCd = ?, " + " performanceDTTM = ?, " + " performanceDesc = ?, " + "lotteryPerformance = ?, " + " lotteryAsgnComplete = ?, " + " performHandicapLogic = ?, " + " maxNumOfCompTks = ?, " + " maxNumOfAdditionalTks = ?, " + " costOfEachAddTk = ? " + " where venueCd = ? and " + " performanceDTTM = ?"; I am using a OleDbType.Date parm to pass in the value of the date time. The value is correct in the parameter and there is a row that it should find and update. Any help would be appreciated. Thanks, Patrick

    C 1 Reply Last reply
    0
    • P pnslcs

      I am trying to update a MS ACCESS table that has a column defined as a datetime type. The update looks like: string updateSQL = "update Perform " + " set venueCd = ?, " + " performanceDTTM = ?, " + " performanceDesc = ?, " + "lotteryPerformance = ?, " + " lotteryAsgnComplete = ?, " + " performHandicapLogic = ?, " + " maxNumOfCompTks = ?, " + " maxNumOfAdditionalTks = ?, " + " costOfEachAddTk = ? " + " where venueCd = ? and " + " performanceDTTM = ?"; I am using a OleDbType.Date parm to pass in the value of the date time. The value is correct in the parameter and there is a row that it should find and update. Any help would be appreciated. Thanks, Patrick

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      Even down to the millisecond? (Just a thought - I've been caught out with that in the past)


      Upcoming events: * Glasgow: Introduction to AJAX (2nd May), SQL Server 2005 - XML and XML Query Plans, Mock Objects, SQL Server Reporting Services... Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton My website

      P 1 Reply Last reply
      0
      • C Colin Angus Mackay

        Even down to the millisecond? (Just a thought - I've been caught out with that in the past)


        Upcoming events: * Glasgow: Introduction to AJAX (2nd May), SQL Server 2005 - XML and XML Query Plans, Mock Objects, SQL Server Reporting Services... Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton My website

        P Offline
        P Offline
        pnslcs
        wrote on last edited by
        #3

        that is a good question. I can view the data in ms access and it does not display sectonds or milliseconds. The value I am passing in is actually read from the row that I am trying to update from a prior select. Colin, is there anything special I should do since I am working with dates with MS Access? Patrick

        P 1 Reply Last reply
        0
        • P pnslcs

          that is a good question. I can view the data in ms access and it does not display sectonds or milliseconds. The value I am passing in is actually read from the row that I am trying to update from a prior select. Colin, is there anything special I should do since I am working with dates with MS Access? Patrick

          P Offline
          P Offline
          pnslcs
          wrote on last edited by
          #4

          :~ I changed the where to: DateValue(performanceDTTM) = DateValue(@oldPerformanceDTTM) I used the DateValue function. I really do not understand why I had to use it since both the column and the parm were datetime data types.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups