Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Dates as character
Message
De
02/07/2015 12:14:02
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Dates as character
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01621700
Message ID:
01621700
Vues:
92
We have a MYSQL table where a datetime value is stored in a character field. How this happened is a long and very painful story - but changing it is, at the moment, not feasible. We have an interface built by a consultant using Visual Maxframe. (The consultant was also not to blame for the data type of the field). There is a piece of code
TEXT TO qTxt NOSHOW TEXTMERGE   
   insert into serno_method_sequence ( idmethodsheet_sequence, idserialno, idmethodsheet, 
   date_started, idrework, rework_date, defect, action_taken, rework_fix  )
   values (<<c_methodsheet_sequence.idmethodsheet_sequence>>, <<ocfg.nIDSerialno>>, <<ocfg.nmethodsheet>>,
   '<<TTOC(DATETIME())>>', <<IIF(thisform.ilRework, curRework.idserno_method_sequence, 0)>>, 
   '<<IIF(thisform.ilRework, DTOC(DATE()), "")>>', '', '', '')
	   
ENDTEXT 

TEXT TO qTxt2 NOSHOW TEXTMERGE   
   Select LAST_INSERT_ID() as newid
ENDTEXT 


nHndl = thisform.nConnHandle
IF nHndl <1
   nHndl = ConnOnly()
ENDIF 

cErrMsg  =GetSQL(nHndl,QTxt)
IF !EMPTY(cErrMsg)
   =MESSAGEBOX(cErrMsg, 16, "Connection Problem")
   RETURN .T.
ENDIF    

cErrMsg  =GetSQL(nHndl,QTxt2, 'curGetSNID')
IF !EMPTY(cErrMsg)
   =MESSAGEBOX(cErrMsg, 16, "Connection Problem")
   RETURN .T.
ENDIF   
   
DO case
CASE RECCOUNT('curGetSNID') = 0
   nID = 0
   
CASE TYPE('curGetSNID.newid') = 'N'
   nID = curGetSNID.newid
   
OTHERWISE
   nID = VAL(curGetSNID.newid)
   
ENDCASE 

IF USED('curGetSNID')   
   USE IN curGetSNID 
ENDIF 
RETURN nID      
Back in February we suddenly started experience mixed values in the results. For FEB 10, for example, we got 5098 records where the character field ("date_started") was of the expected form
02/10/2015 07:08:59
But we also got 2145 records where the result took the unexpected form of
20150210070743
which is the right value but the wrong format.

I've checked the code and can't find any other place that updates the date_started field in the table.

I'm sure I can build an alogrithm to convert the data into the correct format but I'm looking for some insight as to what conditions could cause this discrepancy. There are several different work stations involved, but we can't map any particular record to any particular work station. Could it be something in the drivers, or the operating system (some are Windows 7 and some are still XP machines)?

Any advice will be appreciated.................Rich
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform