Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Set Safety On
Message
 
À
29/03/2006 07:17:18
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Versions des environnements
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01108731
Message ID:
01108734
Vues:
14
>I am exporting data to a csv file using STRTOFILE. I set safety on before i issue the command and it prompts me to overwrite if the file already exists.
>
>How do i trap the reply (ie. 'yes' to overwrite, or 'no' not to)?
>
>SET SAFETY ON
>STRTOFILE("Detail Report" + CHR(13), ALLTRIM(txtSaveAs), .F.)
SET SAFETY OFF
LOCAL bOverwrite, lcFileName, lnH
m.bOverwrite = .t.
m.lcFileName = ALLTRIM(txtSaveAs)
IF NOT EMPTY(SYS(2000, m.lcFileName))
   m.bOverwrite = (MessageBox([Overwrite?],4+32+256) == 6)
   IF m.bOverwrite
      m.lnH = FOPEN(m.lcFileName,12)
      IF m.lnH < 0
         MessageBox([Someone kepp this file opened])
         m.bOverwrite = .f.
      ELSE
         FCLOSE(m.lnH)
      ENDIF
   ENDIF
ENDIF
IF m.bOverwrite
   STRTOFILE("Detail Report" + CHR(13), m.lcFileName, .F.)
ENDIF
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform