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. General Programming
  3. C / C++ / MFC
  4. COleDateTime problem !

COleDateTime problem !

Scheduled Pinned Locked Moved C / C++ / MFC
databasesql-serversysadminhelpquestion
2 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.
  • A Offline
    A Offline
    AkiraOne
    wrote on last edited by
    #1

    hi all, I set a COledateTime object: // DateRec COleDateTime oleDateRec; oleDateRec.SetDateTime(anno, mese, giorno, pMonitor->ore, pMonitor->minuti, pMonitor->secondi); with current datetime Ex.(2006,6,20,16,50,23) When i save oleDateRec.m_dt in a db table field with this insruction: // Comando SQL sSqlCommand.Format(_T("INSERT INTO STOPS_MONITOR (StopCode,DateRec,PlantCode,RoomCode,GroupCode,MachCode,CyclePos,OrderCode,StyleCode,StSize,StColor,StLot,Shift)") _T(" VALUES(%ld,%f,'%s','%s','%s',%ld,%ld,'%s','%s','%s','%s','%s',%d)"), lStopCode, ---> oleDateRec.m_dt, sAffiliationPlant, sAffiliationRoom, sAffiliationGroup, DbTfr.addr, pMonitor->step, sOrderCode, sStyleCode, sStSize, sStColor, sStLot, atoi(tmp_Turno)); in the table STOPS_MONITOR in the field DateRec I see this: 2006, 6, 22 the day is change from 20 to 22!!!!:(:(:( Database is a MSSQL Server the field DateRec is a datetime type. lenght 8 Any idea?? thanks in advanced!!:-D Too many plans make the health badly!!

    L 1 Reply Last reply
    0
    • A AkiraOne

      hi all, I set a COledateTime object: // DateRec COleDateTime oleDateRec; oleDateRec.SetDateTime(anno, mese, giorno, pMonitor->ore, pMonitor->minuti, pMonitor->secondi); with current datetime Ex.(2006,6,20,16,50,23) When i save oleDateRec.m_dt in a db table field with this insruction: // Comando SQL sSqlCommand.Format(_T("INSERT INTO STOPS_MONITOR (StopCode,DateRec,PlantCode,RoomCode,GroupCode,MachCode,CyclePos,OrderCode,StyleCode,StSize,StColor,StLot,Shift)") _T(" VALUES(%ld,%f,'%s','%s','%s',%ld,%ld,'%s','%s','%s','%s','%s',%d)"), lStopCode, ---> oleDateRec.m_dt, sAffiliationPlant, sAffiliationRoom, sAffiliationGroup, DbTfr.addr, pMonitor->step, sOrderCode, sStyleCode, sStSize, sStColor, sStLot, atoi(tmp_Turno)); in the table STOPS_MONITOR in the field DateRec I see this: 2006, 6, 22 the day is change from 20 to 22!!!!:(:(:( Database is a MSSQL Server the field DateRec is a datetime type. lenght 8 Any idea?? thanks in advanced!!:-D Too many plans make the health badly!!

      L Offline
      L Offline
      led mike
      wrote on last edited by
      #2

      Have you tested the SQL Statement in your DB environment? Does it work?

      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