COleDateTime problem !
-
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!!
-
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!!